Stillat / vscode-antlers-language-server

Provides rich language features for Statamic's Antlers templating language, including code completions, syntax highlighting, and more.
https://antlers.dev
MIT License
36 stars 3 forks source link

Issue with view-variables upon formatting #79

Closed andjsch closed 10 months ago

andjsch commented 10 months ago

Describe the bug When saving a file that uses view variables, view is being replicated multiple times.

Note: format on save is enabled in VSCode and the formatter is set to Antlers Toolbox.

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

Versions and Other Plugins/Extensions

To Reproduce Enable Antlers Toolbox, go to a file that uses view variables and see view being added multiple times.

https://github.com/Stillat/vscode-antlers-language-server/assets/9936988/143be20b-a489-46fc-a0bf-362ce9f62e35

If submitting a formatting bug, please include the template contents below as well as an attachment

---
background:
  default: 'bg-green-500/80 p-2 md:p-3 3'
button:
  default: 'backdrop-blur-md bg-green-500/80 hover:bg-green-500 focus:bg-green-500'
---

<div
     class="absolute inset-0 container mx-auto px-2 h-full flex flex-col justify-end pb-10 z-10 header-text {{ site:handle }}">
    <div>
        <div class="inline-block">
            {{ if heading }}
                <div
                     class="headings inline-flex flex-col items-baseline lg:text-6xl md:text-4xl text-2xl text-white backdrop-blur-md p-2 font-bold leading-tight tracking-wider">
                    {{ heading }}
                </div>
            {{ /if }}
            {{ if text }}
                <div
                     class="flex flex-col items-baseline lg:text-xl md:text-base text-sm leading-snug max-w-xl {{ view:background['default'] }} text-white {{ heading ?= 'pt-4' }} font-light">
                    {{ text }}
                </div>
            {{ /if }}
            {{ if link_text }}
                <div class="pt-3">
                    <a
                       href="{{ link }}"
                       class="inline-flex items-center space-x-2 px-3 text-white focus:outline-none font-medium md:text-lg text-base uppercase border-2 border-white {{ view:button['default'] }} group">
                        <span class="py-1">{{ link_text }}</span>
                    </a>
                </div>
            {{ /if }}
        </div>
    </div>
</div>
andjsch commented 10 months ago

Rechecking this again currently. It's only happening in this file for some reason.

andjsch commented 10 months ago

Gotcha: It's only happening if I pass strings into it.

This works: {{ view:fontsize[font_size] }} This doesn't: {{ view:fontsize['default'] }}

JohnathonKoster commented 10 months ago

Thanks for all the extra info! Will check it out sometime later today

On Sun, Nov 5, 2023 at 8:35 AM Andreas Schantl @.***> wrote:

Gotcha: It's only happening if I pass strings into it.

This works: {{ view:fontsize[font_size] }} This doesn't: {{ view:fontsize['default'] }}

— Reply to this email directly, view it on GitHub https://github.com/Stillat/vscode-antlers-language-server/issues/79#issuecomment-1793754900, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABH5R6TJU3LBMC3UKPRPB6LYC6PZ3AVCNFSM6AAAAAA66LQ3FSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOJTG42TIOJQGA . You are receiving this because you are subscribed to this thread.Message ID: @.*** com>

JohnathonKoster commented 10 months ago

Resolved in:

andjsch commented 10 months ago

Thanks for the ridiculously fast update! ❤️