Stillat / blade-parser-typescript

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

The lines keep being indented to the right on every run #107

Open apih opened 1 month ago

apih commented 1 month ago

As per the sample, the lines in the @if statement will be indented to the right on every run. The weird thing is that it only happens to the first @if, but not the subsequent ones.

@section('head-mid')
    <!-- Facebook's Open Graph -->
    @if ($form->picture !== '')
-        <meta property="og:image" content="{{ $form->picture_url }}" />
-    @endif
+            <meta property="og:image" content="{{ $form->picture_url }}" />
+        @endif

    <!-- Twitter's Card -->
    @if ($form->picture !== '')
        <meta property="twitter:image" content="{{ $form->picture_url }}" />
    @endif
@endsection
JohnathonKoster commented 1 month ago

Thanks for the report and code samples! I’ll take a look sometime this week 👍

John Koster

On Tue, Jul 9, 2024 at 4:23 AM Mohd Hafizuddin M Marzuki < @.***> wrote:

As per the sample, the lines in the @if statement will be indented to the right on every run. The weird thing is that it only happens to the first @if, but not the subsequent ones.

@section('head-mid')

@if ($form->picture !== '')-        <meta property="og:image" content="{{ $form->picture_url }}" />-    @endif+            <meta property="og:image" content="{{ $form->picture_url }}" />+        @endif

<!-- Twitter's Card -->
@if ($form->picture !== '')
    <meta property="twitter:image" content="{{ $form->picture_url }}" />
@endif

@endsection

— Reply to this email directly, view it on GitHub https://github.com/Stillat/blade-parser-typescript/issues/107, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABH5R6TBJUXAH7SWA4M3EPDZLOTZTAVCNFSM6AAAAABKSOOLUWVHI2DSMVQWIX3LMV43ASLTON2WKOZSGM4TONRUGE4DMMI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

JohnathonKoster commented 2 weeks ago

Apologize for the late follow up - I am unable to reproduce this. Is that the entire template, and could I also get your formatting config?

Thanks!

apih commented 2 weeks ago

It was not the entire template, but I isolated that part into its own file, and the same behavior occurred.

My .blade.format.json:

{
    "useLaravelPint": true,
    "classStrings": {
        "enabled": false
    },
    "formatJsAttributes": false
}

My .prettierrc.json:

{
    "printWidth": 160,
    "tabWidth": 4,
    "trailingComma": "es5",
    "singleQuote": true,
    "plugins": [
        "prettier-plugin-blade"
    ],
    "overrides": [
        {
            "files": [
                "*.blade.php"
            ],
            "options": {
                "parser": "blade",
                "printWidth": 300
            }
        }
    ]
}