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

Nested Arrays are not formatted as expected #83

Open
3 of 4 tasks
o1y opened this issue Feb 1, 2024 · 1 comment
Open
3 of 4 tasks

Nested Arrays are not formatted as expected #83

o1y opened this issue Feb 1, 2024 · 1 comment

Comments

@o1y
Copy link

o1y commented Feb 1, 2024

Describe the bug
Nested arrays are reduced to a single line.

Impacted Products
Which Antlers Toolbox products does this bug apply to?

  • Antlers Toolbox for VS Code
  • Formatter CLI
  • Antlers Prettier Plugin
  • Antlers Syntax Highlighting (external systems - not VS Code)

Versions and Other Plugins/Extensions
Please include the product version you are reporting a bug for. If you are reporting a bug for products such as Antlers Toolbox for VS Code or the Antlers Prettier Plugin, please include a list of other configured extensions or plugins if you believe they are contributing to the problematic behavior.

To Reproduce
Before

{{
    _array = [
        'one' => 1,
        'two' => 2,
        'three' => [
            'four' => 4,
            'five' => 5
        ]
    ]

    _value = _array['three']['five']
}}

After

{{ _array = ['one' => 1, 'two' => 2, 'three' => ['four' => 4, 'five' => 5]]_value = _array['three']['five'] }}

Expected behavior
Either the nested array is formatted like the input, or at least there should be a space between the two variables if formatting nested arrays is not supported yet.

@jhhazelaar
Copy link

Ran into this issue today. We are using array quite a lot with classes modifier. Example:

<div class="{{ [
    'text-sm ',
    'p-4' => true,
    'font-bold' => is_active,
    'bg-red' => has_error] | classes }}">
    //
</div>

Becomes:

<div
    class="{{ ['text-sm ', 'p-4' => true , 'font-bold' => is_active, 'bg-red' => has_error] | classes }}"
>
    //
</div>

With some array having 40 options it becomes unreadable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants