AvalonEdit: Highlight based on non-regex rules

100 Views Asked by At

Is it possible to highlight text in AvalonEdit based on non-regex rules?

Motivation: I have custom lang with different kind of members and want to show each of them with unique color, but regex doesn't allow that.

actual language is different, C# is used only for demonstration purposes

class MyClass
{
    public void Func() { }
    public int Prop { get; set; }
}

With regex-based highlight I can't show whether this token is method or property

nameof(MyClass.Func); // yellow highlight
nameof(MyClass.Prop); // blue highlight

One of solutions is to use IBackgroundRenderer but it will highlight only background, not foreground

0

There are 0 best solutions below