prettier-plugin-blade icon indicating copy to clipboard operation
prettier-plugin-blade copied to clipboard

[Formatting Bug]: Incorrect formatting

Open ONyklicek opened this issue 1 year ago • 2 comments

Version

2.0.0

Template before formatting

<x-mail::message>
    {{-- Subcopy --}}
    @isset($actionText)
        <x-slot:subcopy>
            @lang(
                        "If you're having trouble clicking the \":actionText\" button, copy and paste the URL below\n".
                        'into your web browser:',
                        [
                            'actionText' => $actionText,
                        ]
                    )
            <span class="break-all">[{{ $displayableActionUrl }}]({{ $actionUrl }})</span>
        </x-slot:subcopy>
    @endisset
</x-mail::message>

Template after formatting

<x-mail::message>
    {{-- Subcopy --}}
    @isset($actionText)
        <x-slot:subcopy>
            @lang(
                        "If you're having trouble clicking the \":actionText\" button, copy and paste the URL below\n".
                        'into your web browser:',
                        [
                            'actionText' => $actionText,
                        ]
                    )
            <span class="break-all">[{{ $displayableActionUrl }}]({{ $actionUrl }})</span>
        </x-slot>
    @endisset
</x-mail::message>

Expected Behaviour

Tag x-slot:xxx should not be edited. When using ignore tags, the code is still refactored. Used in PHPStorm.

.prettierrc

{
    "singleQuote": true,
    "trailingComma": "all",
    "printWidth": 240,
    "tabWidth": 4,
    "endOfLine": "lf",
    "plugins": [
        "prettier-plugin-antlers",
        "prettier-plugin-blade",
        "@prettier/plugin-php",
        "prettier-plugin-tailwindcss"
    ],
    "overrides": [
        {
            "files": "**/*.php",
            "options": {
                "parser": "php",
                "singleQuote": false,
                "phpVersion": "8.2"
            }
        },
        {
            "files": "*.blade.php",
            "options": {
                "parser": "blade",
                "singleQuote": false,
            }
        },
        {
            "files": [
                "**/*.css",
                "**/*.html"
            ],
            "options": {
                "singleQuote": false
            }
        }
    ]
}

Relevant log output

No response

ONyklicek avatar Feb 23 '24 12:02 ONyklicek

Having the same issue. I know that technically the closing tag doesn't need the slot name. But PHPstorm complains that the tags don't match if it's missing. Using ignore tags to prevent this don't work for me either.

benbjurstrom avatar Mar 27 '24 17:03 benbjurstrom

Having the same issue. I know that technically the closing tag doesn't need the slot name. But PHPstorm complains that the tags don't match if it's missing. Using ignore tags to prevent this don't work for me either.

When using <x-slot:subcopy> it is advisable to close them in the same way. In my case the template for mail notifi was corrupted.

ONyklicek avatar Mar 27 '24 17:03 ONyklicek

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

github-actions[bot] avatar May 27 '24 01:05 github-actions[bot]