In our application, we support SQL that contains custom macros of the form "[[token]]" I'm attempting to use the SyntaxEditor for this, but am encountering some issues (almost certainly because I don't know what I'm doing :->).
First, I've tried to modify the SQL Language definition XML so that [[token]] is colored a certain way. I removed the Squery String group tag, since that would be a clear conflict, and added my new thing to the ChildStates key. The XML I've put in is:My understanding is that this should look for things that start with "[[" and end with "]]" and style it after the SystemVariableState style (i.e., green and bold). However, this doesn't happen at all. I figure that there is something that I'm just not getting, but I don't see what.
Also, I created a SyntaxLanguage class to service this, and implemented the IEditorDocumentTextChangeEventSink interface (just like the HtmlDynamicSyntaxLanguage example). I'm trying to trap when the user types "[[", but e.TypedText always only contains a single character. How do I trap that the user has typed two "[" in a row?
Thanks in advance.
David Mullin
First, I've tried to modify the SQL Language definition XML so that [[token]] is colored a certain way. I removed the Squery String group tag, since that would be a clear conflict, and added my new thing to the ChildStates key. The XML I've put in is:
<!-- Ask Tokens -->
<State Key="SystemMacroState" TokenKey="SystemMacroToken" Style="SystemVariableStyle">
<!-- Scopes -->
<Scopes>
<Scope BracketHighlight="True">
<RegexPatternGroup Type="StartScope" TokenKey="SystemMacroStartToken" Style="SystemVariableStyle" PatternValue="[[" />
<RegexPatternGroup Type="EndScope" TokenKey="SystemMacroEndToken" Style="SystemVariableStyle" PatternValue="]]" />
</Scope>
</Scopes>
<!-- Patterns Groups -->
<PatternGroups>
<RegexPatternGroup TokenKey="SystemMacroToken" PatternValue="{NonLineTerminatorMacro}+" />
</PatternGroups>
</State>
Also, I created a SyntaxLanguage class to service this, and implemented the IEditorDocumentTextChangeEventSink interface (just like the HtmlDynamicSyntaxLanguage example). I'm trying to trap when the user types "[[", but e.TypedText always only contains a single character. How do I trap that the user has typed two "[" in a row?
Thanks in advance.
David Mullin