laravel-blade-snippets-vscode
laravel-blade-snippets-vscode copied to clipboard
Incorrect indentation inside directives
Formatting a Blade document is incorrectly indenting code inside directives.
Expected output:
@section('content')
<p>Hello world</p>
@endsection
Actual output:
@section('content')
<p>Hello world</p>
@endsection
Similar with @for directives.
OS: Windows 10, Linux Fedora 29 VS Code: 1.33.1 Laravel Blade Snippets: 1.20.0
Expected output:
<select class="form-control custom-select" name="week">
@for ($i = 0; $i < 52; $i++)
<option value="{{ $i }}">Week {{ $i+1 }}</option>
@endfor
</select>
Actual output:
<select class="form-control custom-select" name="week">
@for ($i = 0; $i < 52; $i++) <option value="{{ $i }}">Week {{ $i+1 }}</option>
@endfor
</select>
I have this issue, too. Formatting any blade.php file results in any blade indentation within blade directives being removed.
does anyone solved it? i have the same issue too and i'm using phpStorm meanwhile :/
Yeah its a hard issue to deal with, anyone have any other blade formatting plugins?
I'd love for this to get implemented. Is anybody still maintaining this project?
also discussed in #61
🦗 🦗 🦗
:/ any other solutions than this?
:/ any other solutions than this?
You can use beautifier. This gist has some bugs but with some effort you can make it work. Look at the comments below the gist.
https://gist.github.com/fzldn/a27973ff7e4c8e3738b0e06e525f7403
You can use beautifier. This gist has some bugs but with some effort you can make it work. Look at the comments below the gist.
https://gist.github.com/fzldn/a27973ff7e4c8e3738b0e06e525f7403
@tsekka Thank you for sharing. For now, it seems a better solution for indentation formatting. Beautifier converts all blade directives to html tag format in order to process document like html.
:/ any other solutions than this?
You can use beautifier. This gist has some bugs but with some effort you can make it work. Look at the comments below the gist.
https://gist.github.com/fzldn/a27973ff7e4c8e3738b0e06e525f7403
Still not a solution in my eyes that you have to change this every time they update the plugin. :/
Broken for years lol
https://github.com/shufo/vscode-blade-formatter
Since this is still broken, you can use the Laravel Blade Formatter package instead of this for formatting.
And be sure to disable the formatting from this package in your settings:
"blade.format.enable": true,