Append colorized string

SyntaxEditor for WPF Forum

Posted 5 years ago by Miguel A.
Version: 18.1.0673


I would also like to use the syntax editor for displaying log output but I struggle with syntax highlighting as I don't want to work with keywords but change foreground / background of a whole text range. Is there a way I can append text in a specific color?

I've seen the Classification - Line start demo but sometimes the errors are multi-lined and I don't want to surround all types (error, log, debug, etc.) with unique keywords or characters like "Errorstart" "Errorend". Instead just append / insert text and say which color it should has.

[Modified 5 years ago]

Comments (1)

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

Hi Miguel,

SyntaxEditor is mainly designed for a lexical parser to create tokens that drive how text gets colors.  That being said, that mechanism is hardnessed by our classification tags system, where text ranges can be assigned classification tags.  Those classification tags get translated to highlighting styles and are what is used to do coloring.  The tokens provide classifications. 

You could choose to not have a lexer on your syntax language and make a classification tagger that returns a classification type to use for requested ranges.  As long as that classification type has a related registered highlighting style, it should get colored.  As you saw, several of our Adornments QuickStarts show the use of classification tags.  

Classification ranges are requested per view line, but your logic for determining what to return could scan text backwards from the requested range in scenarios like what you mentioned where the highlighted lines need to be multi-line.

Actipro Software Support

The latest build of this product (v24.1.2) was released 0 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.