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?
It's not yet implemented for Blade (although exists for Smarty and Twig templates).
https://youtrack.jetbrains.com/issue/WI-29254 -- watch this ticket (star/vote/comment) to get notified on any progress.
来源:https://stackoverflow.com/questions/58401451/how-to-set-syntax-highlighting-to-a-code-section-to-a-specific-language-programm