Stillat/vscode-antlers-language-server

Nested Arrays are not formatted as expected

Opened this issue · 1 comments

o1y commented

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.

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.