Custom language injection

已回答

Hi,

When I edit a php/html file, PphStorm detect "<script>" tag and everything inside is handled as JavaScript (which is pretty useful).
But in my case (Laravel blade file) I don't need to add "<script>" tag but :

@push('scripts')
// some JS script ...
@endpush

I would like to have the same behaviour with "@push('scripts')" than "<script>".

I tried to create a custom language injection rule in setting or using language injection comments, without success :

{{-- language=JS --}}

Any idea ?

2

Hi there,

AFAIK -- no.

Seems related: https://youtrack.jetbrains.com/issue/WI-29254

 

>I tried to create a custom language injection rule in setting or using language injection comments, without success :

It has to be supported at Blade files level. I mean -- parsing and understanding such comments or any other way (implemented from IDE side/part of PHP plugin that is responsible for Blade files support).

Out of 3 supported by PhpStorm mainstream templating systems usually used in PHP applications (I mean: Smarty, Twig, Blade) only Smarty has such functionality implemented (https://youtrack.jetbrains.com/issue/WI-10478 -- it shows in comments how it can be done).

Here is a ticket for Twig files: https://youtrack.jetbrains.com/issue/WI-11277

Similar functionality is required for Blade files. Will that originally mentioned WI-29254 be the right ticket -- not 100% sure -- but looks decent/good enough for me. Comment there to see what the devs are currently thinking about it and what their plans are.

2

请先登录再写评论。