Closed ralphjsmit closed 10 months ago
Would you be able to provide the text version of the template that is exhibiting the issue? Sometimes its the surrounding context that does weird things, and it really helps to resolve the issues quickly :)
Of course!
For example, this file:
@php
use Illuminate\Support\Collection;
@endphp
@props([
'breadcrumbs',
])
<div {{ $attributes->class(['filament-breadcrumbs flex-1']) }}>
<ul
@class([
'hidden items-center gap-4 text-sm font-medium lg:flex',
'dark:text-white' => config('filament.dark_mode'),
])
>
@foreach ($breadcrumbs as $action => $label)
<li>
<button
type="button"
wire:click="{{ $action }}"
@class([
'text-gray-500' => $loop->last && (! $loop->first),
'dark:text-gray-300' => ((! $loop->last) || $loop->first) && config('filament.dark_mode'),
'dark:text-gray-400' => $loop->last && (! $loop->first) && config('filament.dark_mode'),
])
>
{{ $label }}
</button>
</li>
@if (! $loop->last)
<li
@class([
'h-6 -skew-x-12 border-r border-gray-300',
'dark:border-gray-500' => config('filament.dark_mode'),
])
></li>
@endif
@endforeach
</ul>
</div>
I already ran the formatter earlier on the complete project. Then, PhpStorm updated the indentation (which I don't care about, because the code style fixer should fix it anyway before PR merge). So I ran the formatter again and the indentation change stayed visible. I would have expected the indentation change to be reverted to how the code originally was in the previous commit.
Thanks for the extra information!
I'm having trouble getting it to reapply the indentation (the formatter should be removing extraneous whitespace) - will keep trying to figure out how to get it to happen, though.
The formatter was intended to be used with spaces instead of tabs, I wonder if that's contributing 🤔
Hey! I tried updating useTabs: false
and that didn't work either. It seems to just not do anything.
It's a private repo, but I can give you temporary access. Would that be helpful?
Thanks!
Hey! I tried updating
useTabs: false
and that didn't work either. It seems to just not do anything.It's a private repo, but I can give you temporary access. Would that be helpful?
Thanks!
That might help, for sure!
@JohnathonKoster I've just sent you an invite to the repo! Ideally I would like to have the formatter fix the indentation and force one consistent indentation, even though the indentation changed by PhpStorm. E.g. changing indentation by PhpStorm in Blade files is an issue we also have on another big project with multiple devs, because that blows up PRs 😬😄
Sounds great; thank you! I'll poke around this weekend and see if I can track down what's happening :)
Not sure if this is related but after switching from @shufo/prettier-plugin-blade
I'm finding the @class directive is not getting indented correctly.
The deeper the nesting the more the the indention is getting excessively indented.
E.g
<div>
<div>
<div>
<div>
<div
@class([
'grid',
'gap-2' => $key === 'secondary',
'gap-4' => $key !== 'secondary'
])
>
<div>Test</div>
</div>
</div>
</div>
</div>
</div>
Not sure if this is related but after switching from
@shufo/prettier-plugin-blade
I'm finding the @Class directive is not getting indented correctly.The deeper the nesting the more the the indention is getting excessively indented.
E.g
<div> <div> <div> <div> <div @class([ 'grid', 'gap-2' => $key === 'secondary', 'gap-4' => $key !== 'secondary' ]) > <div>Test</div> </div> </div> </div> </div> </div>
same problem with @include
directive
@marynazinchenk Would you be able to provide your prettier settings, blade formatter settings (if configured), version numbers, as well as the original document as an attachment?
I've yet to reproduce this on my end. Thanks!
I noticed that I am still getting indentation issues that are not being fixed by the plugin. I already updated the
"useTabs": true,
in the.prettierc
.Thereby a question, does the plugin format indentation, like tabs/spaces?
I do not necessarily care about whatever version the plugin chooses, as long as it always corrects it to one version.
Thanks!