How is it possible to do manual syntax highlight in SyntaxEditor?
For example chars from index 4 to 10 should be blue and bold, and so on?
Thank you,
Gergely
How is it possible to do manual syntax highlight in SyntaxEditor?
For example chars from index 4 to 10 should be blue and bold, and so on?
Thank you,
Gergely
Hello,
Our control is geared to be a code editor and have the styles be based on lexing/tokenization of the text. While we do support classifications of various text ranges to override default token-based styles and to apply custom styles over those ranges, it's not geared for heavy usage. It sounds like you might rather be looking for a general RichTextBox instead if you are trying to manually color all the ranges yourself and don't do it based on pattern-matching/lexing.
Hi,
do you maybe have then a RichTextBox in which the user can't change the formatting (given by the application) with keyboard shortcuts, etc.?
can also outlining be applied to that?
Thank you
Hello,
No but there is a native RichTextBox in WPF you could set as read-only. It wouldn't have built-in code outlining though.
Hi,
I like the style of your code/text editor very much. So it looks like the easier way for me is to duplicate my ANTLR grammar and write it the Actipro way too (and keep the two grammars synchronized...), rather than to try to build an own code editor from a basic WPF RichTextBox.
Do you maybe have some advice or some automation tool to keep ANTLR and Actipro grammars in sync? (Or generate an Actipro langdef from ANTLR?)
Thanks
If you have a code-oriented language, you could build a lexer from our tools to accomplish basic syntax highlighting. And you could make a custom IParser service that just wraps a call to your ANTLR grammar parser. That way you could call your existing ANTLR grammar parser asynchronously (via a worker thread in our parse request dispatcher) any time text changes. You just couldn't use those results to do syntax highlighting. But they'd be available in the document's ParseData property each time parsing completes for other examination purposes.
That would be good, but the problem is that I need the parser as well for syntax highlighting, I can't just rely on the lexer. ...or syntax highlighting won't be very good...
...or maybe I do a mixture by doing basic syntax highlighting with the lexer defined the Actipro way, and do the additional highlighting with the help of the ANTLR AST.
So this leads back to the original question: how can I manually format the text in the code editor? (Let's suppose I won't use it heavily...)
Hello,
The "SyntaxEditor / User Interface Features / Adornment Features / Syntax Highlighting" topic talks a bit about this. You effectively make a classification tagger with related styles registered in the ambient highlighting style registry, and have to tag the ranges you want custom highlighting on. A number of the Adornments samples show use of this kind of feature too.
Hello,
thank you, this is what I was looking for!
Please log in to a validated account to post comments.