Haehnchen / idea-php-laravel-plugin

Laravel Framework Plugin for PhpStorm / IntelliJ IDEA
MIT License
572 stars 108 forks source link

"Comment With Line Comment" Action uses the wrong comment style in @php blocks #264

Open natepisarski opened 3 years ago

natepisarski commented 3 years ago

I frequently use the 'Comment With Line Comment' command in Idea to turn single-line debugging statements on or off.

For instance, pressing ctrl+// on this line:

$comment = 4;

would turn it into this:

//$comment = 4;

The style of the comment changes in different file extensions. In a .blade file it would make this type of line comment:

{{-- $comment = 4; --}}

However, if you use this command within a @php block in Blade, it will continue using the general 'blade' style comment:

  @php 
     $comment = 4; // COMMENT ON THIS LINE
  @endphp

becomes this:

@php
  {{--    $comment = 4; // COMMENT ON THIS LINE--}}
@endphp

This is a syntax error because everything inside the @php will just be interpreted as PHP code, and not pre-processed in Blade.


I'm not sure if it's possible to make the 'Comment With Line Comment' context-sensitive from this plugin. If it's not, feel free to close this issue.