'Blade template code formatting issue in PhpStorm
I am using PhpStorm 8.0.3 and Blade Templating (using Laravel) and when I reformat code it gets really nasty
full tab image after disabling blade plugin and formatting
full tab image with blade plugin enable
I tried possible solutions described at the Jetbrains issue tracker which didnt work
Does anyone have any idea why this happening?
Solution 1:[1]
I write all the PHP, HTML, Blade code in phpstorm2020.1, and sometimes in VSCode too. I saw major difference how these two IDE's format code. Sometimes PHPStorm does not format the blade very well, you have to go to the Settings by pressing Ctrl + Alt + S, then Editor -> Code Style, here you will find PHP and Blade format settings, do some stuff with the settings and make your own settings. Whenever you'll install a newer version, all the settings will be migrate to latest version. Obviously PHPStorm is much powerful but VSCode formats the blade very well. You can install Prettier plugin too to for the proper formatting.
Even latest phpstorm2022.1, sometimes it won't format the code properly when the code is big, it mis-aligns the @directives and content into the directives etc when pressing CTRL + ALT + L.
I then stackoverflowed the solution, tried to install Prettier via NPM but it does not the same as I want.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |

