WPF support for "dynamic" languages

SyntaxEditor for WPF Forum

Posted 5 years ago by Erel Uziel
Version: 14.2.0611
Avatar

I'm a long time user of the WinForms SyntaxEditor control.

I now want to move to the WPF control. Is it possible in the WPF control to modify the language during runtime (for example adding new types that should be colored differently).

 

Another question, will it be possible to implement conditional compilation? For example:

#If SOME_CONSTANT

grey text here

#else

normal text here

#endif

Comments (3)

Posted 5 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Erel,

Do you mean that you'd like type names to be colored differently from normal identifiers?  If so, while we have done some looking into this, we haven't gotten it working in a performant way since you effectively need to run the resolver on every identifier in the document.

We don't currently have anything built in for conditional compilation.  In the WPF version, you could possibly achieve something like this though by using classification taggers and tagging each "false" range's text using style with a gray foreground.  I'll log the suggestion for built-in support of this.


Actipro Software Support

Posted 5 years ago by Erel Uziel
Avatar

With the WinForms control I'm using this code to update the types when a background thread detects a new type:

IsUpdating = true;
LexicalPatternGroup lpg = ((DynamicLexicalState)LexicalStates[0]).LexicalPatternGroups["TypeWordToken"];
lpg.Clear();
currentTypes.Clear();
foreach (string s in types)
{
lpg.Add(new LexicalPattern(s));
}
IsUpdating = false;

 

Can we do similar thing with the new control?

Posted 5 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Yes, you can but there's a different syntax than IsUpdating.  Please see the "SyntaxEditor / Text/Parsing Framework / Lexing / Basic Concepts" topic in the documentation and look at the "Changing Mergable Lexers" section in that.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.