CM6 – custom highlighting using MatchDecorator

I’m trying to create a basic syntax highlighting to work with Laravel Blade template language (on top of HTML language). Found just an example how to create some custom highlighting using MatchDecorator, but it’s too simple for what I need.

I think I understand the way MatchDecorator works, but I need an advice for a more complex usage.

Let’s say I need to highlight this string:

@if ( $value === 'something' )

I want to highlight @if / $value / ‘something’ using different classes (colors). Is it possible to achieve it using one single MatchDecorator, or what is the right way in CM6 to do it? Create multiple MatchDecorators with different regular expressions and somehow combine it into a single ViewPlugin?

What I have right now is a single MatchDecorator that is able to highlight @if using a tags.typeName class (so I’m using the built-in classes), but I’m stuck because I can’t find any other example how to create more complex highlighting.

Thanks for any advice.

No, MatchDecorator isn’t going to be much use for syntax highlighting. See this example for a walkthrough of the way language packages are written.

Thank you for your response.

Building a completely new language is not necessary in my case, because I just need some extra highlighting rules inside a HTML code.

I guess this thread describes similar “problem” (found it later).

Similar to the CM5 overlay mode. But I see you said you are working on it, so I will wait for some updates :wink: