laravel-blade-snippets-vscode icon indicating copy to clipboard operation
laravel-blade-snippets-vscode copied to clipboard

Formatting removes all indentation

Open donaldhubduck opened this issue 5 years ago • 7 comments

I have event tried this on a clean install of Ubuntu on a virtual machine with only vs code with this extension. As soon as I format the document it removes all indentation.

Before formatting: https://prnt.sc/py5gut

After formatting https://prnt.sc/py5h0h

Thanks! :)

donaldhubduck avatar Nov 17 '19 15:11 donaldhubduck

Yeah this is something I've been ignoring but as I get more and more nested blade directives in a page I'd want to see them indented. A good example where this makes it completely unscannable is for, break, continue loops...

@section('content')
  @for(range(0,10) as $n)
    @if($n === 0)
      <div>
        Header
      </div>
      @continue
    @endif

    @unless($n > 9)
      <div>
        {{ $n }}
      </div>
      @break
    @endunless
  @endfor
@endsection

Gets turns into

@section('content')
@for(range(0,10) as $n)
@if($n === 0)
<div>
  Header
</div>
@continue
@endif

@unless($n > 9)
<div>
  {{ $n }}
</div>
@break
@endunless
@endfor
@endsection

This is a dupe of this issue here. https://github.com/onecentlin/laravel-blade-snippets-vscode/issues/92

kylemilloy avatar Nov 20 '19 23:11 kylemilloy

Same for me, exist othe blade formatter to vs code? i can't find one :(

josuerodcat90 avatar Feb 29 '20 22:02 josuerodcat90

also discussed before in #61 An alternative, I found a hack for the Beautify extension made by someone, and posted it as an answer here: https://stackoverflow.com/a/60713478/1925358 Maybe that could be leveraged to improve this extension and provide blade directive indentation.

Slivicon avatar Mar 16 '20 18:03 Slivicon

Any more updates with this? I really just want to use this plugin and not involve beautify.

alexkerber avatar May 09 '20 13:05 alexkerber

Its too annoying -_-

iRaziul avatar Jul 25 '21 19:07 iRaziul

still unusable because of this issue in 2022

diontron avatar Feb 12 '22 20:02 diontron

If you're just looking for the formatter, this is what I've been using. https://github.com/shufo/blade-formatter

It has its own couple of issues but it works far better.

kylemilloy avatar Feb 12 '22 20:02 kylemilloy