plugin icon indicating copy to clipboard operation
plugin copied to clipboard

[Bug]: Laravel Idea breaks insert paired brackets and quotes inside blade.php files

Open omark96 opened this issue 1 year ago • 4 comments

Bug description

Pressing [, ' or any other bracket inside a blade.php does not auto-close. Expected output: [] Current output: [

It works as expected inside a normal php file as well inside json. Before the plugin has indexed all files it works within blade.php as well, but as soon as it's all indexed it stops working.

After disabling the plugin everything works as expected.

Plugin version

8.4.0.241

Operating system

Windows

Steps to reproduce

Enable auto-closing in PhpStorm and have Laravel Idea enabled and create a blade.php file and try to type [ or any other bracket.

Relevant log output

No response

omark96 avatar Oct 26 '24 01:10 omark96

https://github.com/user-attachments/assets/271924fc-becf-4bc3-80a5-def42de1d843

In this video I first have a blade.php file open without Laravel Idea enabled and the auto-closing of [ works perfectly. I then enable Laravel Idea and restart PhpStorm (There's a small cut to not show my desktop) and the auto-closing works while the files are being indexed. Once the indexing is done and the blue bar down to the right is gone it only works sporadically if spammed.

omark96 avatar Oct 26 '24 09:10 omark96

Hello. I couldn't repeat it. And honestly, I can't imagine how Laravel Idea can break something like that...

adelf avatar Oct 26 '24 11:10 adelf

I understand, I'm at a loss too. I have tried reinstalling PhpStorm (removing all configs) and Laravel Idea as well, but still the same issue. I guess the only thing I have left to try is to reinstall Windows,

omark96 avatar Oct 26 '24 12:10 omark96

Please don't reinstall Windows. It won't help.

I'll try to ask PhpStorm team about it.

adelf avatar Oct 26 '24 12:10 adelf

I did some more digging and there seems to be some kind of issue with PhpStorm detecting that I am inside an injected PHP file when using Volt components while Laravel Idea is enabled. When I have Laravel Idea enabled and click around inside the php parts I can see the following at the bottom: image But when Laravel Idea is disabled it consistently detects that I am inside injected php: image The bracket pairing breaks because it does not work while you are inside a blade.php part, not even when Laravel Idea is disabled for me.

EDIT:

I also now found out that if I disable the Blade plugin and restart PhpStorm the bracket pairing works again with Laravel Idea enabled. If I then enable the Blade plugin auto-pairing still works, but I get showered by exceptions from Laravel Idea and the auto-complete is not working at all anymore.

omark96 avatar Oct 27 '24 21:10 omark96

I was able to replicate the problem on my laptop as well and it seems to be Livewire Volt component files that has this issue. These are the steps I took as exact as I can recall:

Fresh install of PhpStorm, Laravel Idea and Laravel Herd.

laravel new maryuidemo
cd maryuidemo
composer require robsontenorio/mary
php artisan mary:install (Install Volt during the installer)
npm run dev

Open resources/views/livewire/users/index.blade.php and make sure that Laravel Idea has finished indexing the project. Inside the PHP section the auto-pairing is now not working, now if you disable Laravel Idea and restart it works again.

Sorry, should have properly described how to reproduce it.

omark96 avatar Oct 28 '24 19:10 omark96

image

iurigustavo avatar Oct 30 '24 17:10 iurigustavo

This is just behavior of Blade plugin. Blade files are templates, and closing brackets work for semantic language blocks, and they work correctly within code:

https://github.com/user-attachments/assets/81b21e77-f499-45c6-879c-2c42db1fa92d

Outside code brackets in templates are just text, so they are not auto-closed. Disabling Blade plugin just converts blade file handling from template to plain php, making everything code.

Not much to do here from our side, if this behavior is to change, it should be done by Blade plugin itself. Hopefully this explanation helps.

gorbunov avatar Jun 04 '25 08:06 gorbunov