Hi I was developing some Javascript code editor with Actipro Web add-on.
And I needed to add some keyword ( my custom class name ) like TAccout, TGraph into pure Javascript language.
So I used JavaScriptSyntaxLanguage at First, and then I registered additional DynamicLexer.
I expected that keyword from pure javacsript and my language will be highlighted together, but only javascript keyword were worked.
I don't know how to fix my code.
My codes follows
public class TradeJsLexer : DynamicLexer
{
public TradeJsLexer()
{
//I know that this is the wrong way to register color to this ClassificationType
//But I don't know how to match some color to ClassificationType.
//I want to make this TAccount TGraph keywords highlighted. :(
var cf = new ClassificationType("TradeJsClassType", "#FF2B91AF");
var lexicalPatternGroup = new DynamicLexicalPatternGroup(DynamicLexicalPatternType.Explicit, "TradeJsClassType", ClassificationTypes.Keyword);
lexicalPatternGroup.Patterns.Add(new DynamicLexicalPattern("TAccount"));
lexicalPatternGroup.Patterns.Add(new DynamicLexicalPattern("TGraph"));
this.DefaultLexicalState.LexicalPatternGroups.Add(lexicalPatternGroup);
}
}
this.SyntaxEditorObj = new SyntaxEditor();
this.SyntaxEditorObj.Document.Language = new JavaScriptSyntaxLanguage();
this.SyntaxEditorObj.Document.Language.RegisterService(new TradeJsLexer());