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

Awkward line wrapping of tag modifiers #50

Closed pdipatrizio closed 1 year ago

pdipatrizio commented 1 year ago

Describe the bug Antlers Toolbox is awkwardly wrapping tag modifiers onto new lines. I get the same result when using the Antlers Prettier Plugin, so the Toolbox itself appears to be the root cause.

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

Versions and Other Plugins/Extensions Antlers Toolbox v2.3.7. I've disabled all other extensions while testing, so they're irrelevant to the issue..

Example code before formatting

{{ page_builder limit="1" }}
    {{ if article }}
        {{ article | raw | where('type', 'paragraph') | bard_text | safe_truncate(180, '...') | entities | mark }}
    {{ elseif text }}
        {{ text | safe_truncate(180, '...') | entities | mark }}
    {{ /if }}
{{ /page_builder }}

Example code after formatting w/ Antlers Toolbox

{{ page_builder limit="1" }}
    {{ if article }}
        {{ article | raw | where('type', 'paragraph')
 | bard_text | safe_truncate(180, '...')
 | entities | mark }}
    {{ elseif text }}
        {{ text | safe_truncate(180, '...')
 | entities | mark }}
    {{ /if }}
{{ /page_builder }}

VS Code Settings.json Only included my current settings that are relevant to HTML/Antlers. I've tried countless variations of settings but nothing prevents the awkward modifier wrapping. I also tried setting html.format.wrapLineLength to 0 (disabled) but that didn't have any affect either.

{
  "antlersLanguageServer.languageVersion": "runtime",
  "antlersOverrideHtmlComments": true,
  "html.format.wrapAttributes": "preserve-aligned",
  "html.format.indentInnerHtml": true,
}
JohnathonKoster commented 1 year ago

@pdipatrizio Thanks for the report! I was able to reproduce on a much simpler template, and will work on improving this 🙂

JohnathonKoster commented 1 year ago

Note to self: it is the ) that is causing the extra newline. Need to disable this behavior when the next token is a modifier separator.

JohnathonKoster commented 1 year ago

Resolved in: