
I'm a bit new to the SyntaxEditor, but I'm having an issue with Squiggles.
I've defined a language using the Language Designer. It contains a patterngroup that is explicit with one pattern added. At runtime, I get that patterngroup, clear the patterns, and add more patterns.
I've registered the CodeDocumentTaggerProvider<ParseErrorTagger> and now when I type in the Editor, if I type one of my patterns, the squiggle is there. If I type the original pattern that was first set up before I cleared them, then there is no squiggle. Do I need to somehow refresh something after I add patterns to any of the lexical states?
// Part of the auto generated Lexer.g.cs class
// Initialize the Default lexical state
lexicalState = lexicalStates["Default"];
lexicalPatternGroup = new DynamicLexicalPatternGroup(DynamicLexicalPatternType.Explicit, "ThePattern", classificationTypeProvider.MyType);
lexicalPatternGroup.TokenId = MyTokenId.MyType;
lexicalPatternGroup.Patterns.Add(new DynamicLexicalPattern("ThePattern"));
// Part of my code that initializes the patterns
var myLexer = (DynamicLexer)syntaxEditor.Document.Language.GetLexer();
using (var batch = myLexer.CreateChangeBatch())
{
var myPatternGroup = myLexer.DefaultLexicalState.LexicalPatternGroups.FirstOrDefault(g => g.TokenId.Equals(MyTokenId.MyType));
if (myPatternGroup == null)
{
return;
}
myPatternGroup.Patterns.Clear();
foreach (var pattern in listofpatterns)
{
myPatternGroup.Patterns.Add(new DynamicLexicalPattern(pattern.ToString()));
}
}
[Modified 12 years ago]