Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Formatting Bug]: Custom directive incorrectly indented #840

Open
GeertHauwaerts opened this issue Apr 30, 2024 · 1 comment
Open

[Formatting Bug]: Custom directive incorrectly indented #840

GeertHauwaerts opened this issue Apr 30, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@GeertHauwaerts
Copy link

Platform

Windows

Template before formatting

@hasRolePermission(AccountMemberRole::USER, 'lt')
    <x-common.nav-bar.nav-bar-item
        :icon="'account_box'"
        href="{{ route('dashboard-accounts-account-manage-members', ['account' => $account->ulidl]) }}"
        routename="dashboard-accounts-account-manage"
        :category="'manage'"
    >
        {{ __('account.sidebar.manage') }}

        <x-slot:children>
            <x-common.nav-bar.nav-bar-subitem
                href="{{ route('dashboard-accounts-account-manage-members', ['account' => $account->ulidl]) }}"
                routename="dashboard-accounts-account-manage-members"
            >
                {{ __('common.members') }}
            </x-common.nav-bar.nav-bar-subitem>
        </x-slot:children>
    </x-common.nav-bar.nav-bar-item>
    @else
    meow
    @endhasRolePermission

Template after formatting

@hasRolePermission(AccountMemberRole::USER, 'lt')
    <x-common.nav-bar.nav-bar-item
        :icon="'account_box'"
        href="{{ route('dashboard-accounts-account-manage-members', ['account' => $account->ulidl]) }}"
        routename="dashboard-accounts-account-manage"
        :category="'manage'"
    >
        {{ __('account.sidebar.manage') }}

        <x-slot:children>
            <x-common.nav-bar.nav-bar-subitem
                href="{{ route('dashboard-accounts-account-manage-members', ['account' => $account->ulidl]) }}"
                routename="dashboard-accounts-account-manage-members"
            >
                {{ __('common.members') }}
            </x-common.nav-bar.nav-bar-subitem>
        </x-slot:children>
    </x-common.nav-bar.nav-bar-item>
@else
    meow
    @endhasRolePermission

Expected Behaviour

    @hasRolePermission(AccountMemberRole::USER, 'lt')
        <x-common.nav-bar.nav-bar-item
            :icon="'account_box'"
            href="{{ route('dashboard-accounts-account-manage-members', ['account' => $account->ulidl]) }}"
            routename="dashboard-accounts-account-manage"
            :category="'manage'"
        >
            {{ __('account.sidebar.manage') }}

            <x-slot:children>
                <x-common.nav-bar.nav-bar-subitem
                    href="{{ route('dashboard-accounts-account-manage-members', ['account' => $account->ulidl]) }}"
                    routename="dashboard-accounts-account-manage-members"
                >
                    {{ __('common.members') }}
                </x-common.nav-bar.nav-bar-subitem>
            </x-slot:children>
        </x-common.nav-bar.nav-bar-item>
    @else
        meow
    @endhasRolePermission

Relevant log output

No response

@GeertHauwaerts GeertHauwaerts added the bug Something isn't working label Apr 30, 2024
@davidwebca
Copy link

davidwebca commented Jun 11, 2024

Hi,

I have a similar problem where extra commas are added to associative arrays inside directives.

@image($image, [
    'size' => 'lg'
])

becomes

@image($image, [
    'size' => 'lg',
])

The extra comma is fine in PHP, but Blade's parsing thinks this is a comma for arguments inside the function and janks out somehow. Granted - that might be a problem with blade's parser itself. 🤔

Anyway let me know if you want me to create a separate issue if this isn't the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants