vscode-blade-formatter
vscode-blade-formatter copied to clipboard
[Formatting Bug]: Chaining method issue
Platform
MacOS
Template before formatting
<flux:tab :data-selected="request()->routeIs('meals*')" href="{{ route('meals.index') }}">
Template after formatting
<flux:tab :data-selected="request() - > routeIs('meals*')" href="{{ route('meals.index') }}">
Expected Behaviour
The arrow between request() and routeIs() should not get expanded
Relevant log output
No response
I understand that it's because im using Flux components instead of basic Laravel components after reading: #506
@dicktornfeldt I have the same issue with Flux components, did you find a fix for this? Because I would like to use VS Code (actually Cursor) instead of PhpStorm but I have issues with the formatting of Blade files.
Because for example I would like to use the following:
<flux:button size="sm" icon="chevron-up" :disabled="$item->user_id === auth()->id()">
{{ $upvoteCount }}
</flux:button>
But after saving it formats like this
<flux:button size="sm" icon="chevron-up" :disabled="$item - > user_id === auth() - > id()">
{{ $upvoteCount }}
</flux:button>
Thanks!
Yeah, I had to disable the extension alltogether because it made it unusable to have to deal with those spacing :(
You can disable formating for a line of code just like this:
{{-- blade-formatter-disable --}}
<flux:accordion.item :expanded="$loop->first">
{{-- blade-formatter-enable --}}
For strings the problem can be bypassed by passing the variable in curly brackets, icon="{{ $item->icon }}" rather than :icon="$item->icon". Does not seem to work for booleans like disabled="{{ $item->disabled }}" though.
Same problem here, I solved using @ instead of : it works but its not "the correct way"
<flux:navlist.item ... @current="request()->routeIs('admin.dashboard')" ...>
seems to work because the formatter it's ignoring it
I got same error,
<flux:navlist.item :href="tenant_route('tenant.settings.business_profile')" :current="request() -> routeIs('tenant.settings.business_profile')" wire:navigate>
{ __('Business Profile') }}
</flux:navlist.item>
And after formated
<flux:navlist.item :href="tenant_route('tenant.settings.business_profile')" :current="request() - > routeIs('tenant.settings.business_profile')" wire:navigate>
{ __('Business Profile') }}
</flux:n
i got this error to in livewire starter kit
Please see @dadastudio ’s comment. I have found this similar workaround useful:
<flux:input wire:model="myfield"
{{— blade-formatter-disable-next-line —}}
:disabled="$this->myBooleanValue()"
placeholder="My Placeholder" />
Sorry for late reply.
v0.25.0 released just now introduces Component Prefix option that allow specify custom component name like flux
Please upgrade extension to latest version and specify this option as x-,livewire,flux
This option will preventing unexpected formatting of component attribute.
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