Syntax highlighting does not work for script tag with non-standard attribute

Hello everyone,

I have search several similar posts but did not find a solution for my problem. My script-tag inside an html file has two additional attributes and looks like this:

 <script cam-script type="text/form-script">
var cfg_frontend = camForm.variableManager.variable("cfg_frontend").value;
// [...]

Inside this script tag, syntax highlighting does not work. I have also tried the context action "inject language" -> "javascript" but this did not change anything. I would like IntelliJ to treat this script tags as if they were standard javascript tags. Is that possible with IntelliJ Ultimate?

Thanks and regards

  Dierk

3 comments
Comment actions Permalink

Hi there,

Works for me:

 

The Language Injection rule (a copy of standard "script" rule but with extra rule for the "type" attribute):

PhpStorm 2021.3.1 on Windows 10, x64

1
Comment actions Permalink

I created the injection like explained in the screenshot above, but the syntax highlighting does not work. Creating a xml tag injection like explained in the other post does not work, the menu entry for xml tag injections is disabled:

0

Please sign in to leave a comment.