Stillat / blade-parser-typescript

A Laravel Blade parser, compiler, and static analyzer written in TypeScript.
https://stillat.com
MIT License
90 stars 3 forks source link

`@if` condition wrong formatting when indented #26

Closed zepfietje closed 1 year ago

zepfietje commented 1 year ago

Input

<div>
    @if (count($tenants = filament()->getUserTenants(filament()->auth()->user())))
    @endif
</div>

Output

<div>
    @if (count(
    $tenants = filament()->getUserTenants(
        filament()
            ->auth()
            ->user()
    )
))
    @endif
</div>

Would expect input to remain unchanged, or indentation to be proper.

JohnathonKoster commented 1 year ago

Behavior improved in 1.1.6. If the directive parameters begin/end on the same line, it will stay that way.

However, if they are purposely separated it will now indent relative to the opening:

<div>
    @if (count(
        $tenants = filament()->getUserTenants(
            filament()
                ->auth()
                ->user()
        )
    ))
    @endif
</div>
zepfietje commented 1 year ago

Looks good to me, thanks again! 💪