How to set syntax highlighting to a code section to a specific language programmatically/with comments?

Viewed 352

I have a Laravel blade template (.blade.php) which contains plain JavaScript as a section that will be later inserted into a generic wrapper. So the example would be:

<div>Some HTML content</div>
@section('js')
var a = "b";
someCall();
@endsection

Now PhpStorm would recognize the JavaScript if it was in <script> tag, which it can't be. So I've tried this which I would expect to work like a section highlighter hint:

@section('js')
   // @lang JavaScript
   var a = "b";
   someCall();
   // @endlang
@endsection

and this

@section('js')
   // language=JavaScript
   var a = "b";
   someCall();
@endsection

But nothing worked (clickable language injection breaks other highlighting).

What am I doing wrong? How can I programmatically/commentarily set a section to be highlighted as a language I specify?

1 Answers
Related