Setting language for specific section ?

SyntaxEditor for Windows Forms Forum

Posted 17 years ago by Dan Oren - Software Developer, Watchfire
Avatar
I am using CustomHighlightingStyle for tokens to set their font and color.
Since I set the editor language to HTML I can't see the changes that I made with the CustomHighlightingStyle :
//Loading the language definition xml file.
editor.Document.Language.IsUpdating = true;
editor.Document.LoadLanguageFromXml(@"MyHTMLFile.xml", 0);
editor.Document.Language.IsUpdating = false;

editor.Document.Tokens[100].CustomHighlightingStyle = new HighlightingStyle("myStyle", "myStyle", Color.Red, Color.Yellow, true, false, false);
editor.Document.Tokens[100].Modified = true;
Is there a way to set the language for a specific section in the text and not all the text ?
(I need this also for other cases)
Is there a priority order that I can control in order to set the CustomHighlightingStyle to be "Strongest" then the language ?

Dan

Dan Oren

Comments (1)

Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
No SyntaxEditor is designed for the root language to be doing the determination of
when language shifts occur. So you need to define patterns for the transition to be made.

For CustomHighlightingStyle, you should not be doing those where you are. Instead,
add a semantic parser that scans the code in the parse range and assigns them.
The semantic parse phase occurs after the lexical one so it allows you to overwrite
what the lexical parser assigned. And since it tells you the parse range you can
optimize your search so that it only updates the appropriate range.


Actipro Software Support

The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.