0

I'm writing an IntelliJ plugin, which should recognize rythm engine code in .html files. Rythm is a template engine an the syntax starts with @

I've already done the custom language plugin tutorial from the JetBrains doc.

So far I got Syntax Highlighting partially working for rythm. If I would copy and paste the code below in a .rythm file everything would be well recognized. But then HTML wouldn't be recognized.

I tried the language injection from the IntelliLang plugin but now it recognizes the rythm code only between HTML tags.

In this example @i18n and @something would be recognized as rythm. But @rythmCode is still unhighlighted.

Any ideas how I can get it working even if @rythmCode is outside of HTML tags?

@rythmCode {
<li>
<a href="/xxx">@i18n("xxx")</a>
</li>
<li>
<a href="/xxx/@something.getSomething()">@something.getSomething():@something.getSomething()</a>
</li>
}

@rythmCode() {
<div class="row">
<div class="col-md-6 word-wrap">
    @something.getSomething(): @something.getSomething()
    </div>
<div class="col-md-6 align-right">`

edit:

Finally it works. Now I want to implement a formatter. How can I implement a HTML formatter for the HTML part and a Rythm formatter for the Rythm part?

edit 2: HTML formatter works. Now I need a bit help with the Rythm Formatting. I think something is wrong with my .bnf file.

4

1 に答える 1