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

Formatting of @ directives within tag attributes broken? #67

Closed cheesegrits closed 1 year ago

cheesegrits commented 1 year ago

It seems to be struggling with [at]directives inside tag attributes?

This by itself is fine, so ...

@unless(config('filament-media-library.settings.show-upload-box-by-default'))
    x-show="showUploadBox"
    x-collapse
    x-cloak
@endunless

... formats to ...

        @unless (config('filament-media-library.settings.show-upload-box-by-default'))
            x-show="showUploadBox" x-collapse x-cloak
        @endunless

... but ...

<div
    class="my-4"
    @unless(config('filament-media-library.settings.show-upload-box-by-default'))
         x-show="showUploadBox"
         x-collapse
         x-cloak
     @endunless
>

... formats to ...

<div
    class="my-4"
    @unless(config('filament-media-library.settings.show-upload-box-by-default'))
        x-show="showUploadBox"
    x-collapse
    x-cloak
    @endunless
>

Or ...

<div
    class="my-4"
    @unless(config('filament-media-library.settings.show-upload-box-by-default')) x-foo
         x-show="showUploadBox"
         x-collapse
         x-cloak
     @endunless
>

... (with the errant x-foo trailing) formats to ...

<div
    class="my-4"
    @unless(config('filament-media-library.settings.show-upload-box-by-default')) x-foo
    x-show="showUploadBox"
    x-collapse
    x-cloak
    @endunless
>

Thanks for all your great work on this plugin.

JohnathonKoster commented 1 year ago

Not broken necessarily - just a current limitation since the underlying parsers weren't good enough at the time of initial release to confidently do this - so it works to return the original content to not risk breaking things.

Will look into it now, though :)

cheesegrits commented 1 year ago

Thanks!

JohnathonKoster commented 1 year ago

This feature is now available in 1.6.8 🙂