shufo / prettier-plugin-blade

Format your blade template using Prettier
https://www.npmjs.com/package/@shufo/prettier-plugin-blade
MIT License
330 stars 8 forks source link

[Formatting Bug]: `@break` inside `@if` inside `@foreach` loop indentation #288

Closed chrillep closed 2 months ago

chrillep commented 5 months ago

Version

^1.14.1

Template before formatting

@foreach ($users as $user)
    @if ($user->type == 1)
        @continue
    @endif

    <li>{{ $user->name }}</li>

    @if ($user->number == 5)
        @break
    @endif
@endforeach

Template after formatting

@foreach ($users as $user)
    @if ($user->type == 1)
        @continue
    @endif

    <li>{{ $user->name }}</li>

    @if ($user->number == 5)
    @break
@endif
@endforeach

Expected Behaviour

https://laravel.com/docs/11.x/blade#loops:~:text=When%20using%20loops,directives%3A

for @if and @break inside a @foreach should be scoped and indented correctly

Relevant log output

No response

github-actions[bot] commented 3 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

chrillep commented 2 months ago

@shufo reopen :)