Skip to content

feat(server): navigation and block checks for Liquid templates - #253

Merged
x-ror merged 2 commits into
mainfrom
feat/liquid-1.0
Nov 14, 2026
Merged

x-ror merged 2 commits into
mainfrom
feat/liquid-1.0

Conversation

@x-ror

@x-ror x-ror commented Nov 14, 2026

Copy link
Copy Markdown
Owner

Closes #98. Phases 2 and 3, so Liquid ships as a full language in 1.0. It is no longer marked experimental, and the Stability page covers it.

Navigation

Go to Definition, document links, hover and completion work for {% render %}, {% include %} and {% include_relative %}, with quoted names, Jekyll's unquoted names and {%-. Names are resolved in this order:

  • Jekyll: _includes/<name> under the nearest _config.yml, _config.yaml or _config.toml. include_relative is relative to the file. Names with .. resolve to nothing, as in Jekyll.
  • Shopify theme: snippets/<name>.liquid under the nearest folder that has snippets/ plus layout/ or config/settings_schema.json.
  • Otherwise: the liquid gem's _<name>.liquid next to the file, then _<name>.html.liquid.

Completion skips hidden folders, node_modules, _site and vendor. Rails behaviour stays gated off for Liquid documents.

Checks

Four errors, also reported by ruby-templates check:

  • Syntax/LiquidUnclosedTag: a {{ or {% that is never closed.
  • Syntax/LiquidUnclosedBlock: a block tag without its end tag.
  • Syntax/LiquidStrayEndTag: an end tag with no open block.
  • Syntax/LiquidMismatchedEndTag: an end tag for a different block.

What is read and what isn't:

  • Checked blocks: if, unless, for, case, capture, tablerow, form, paginate, highlight, plus comment, raw and doc.
  • Unknown custom {% x %}…{% endx %} tags are ignored.
  • The bodies of raw, comment and doc are not read as tags, the way the liquid gem treats them, including raw inside comment.
  • Jekyll front matter is skipped.
  • Multi-line {% liquid %} statements are checked.

rubyTemplates.liquid.disabledDiagnostics switches these rules off in the editor.

Not done: refs inside {% liquid %} and inside multi-line tags, and checking that else/when sit in the right block.

Tests

  • liquid.rs unit tests: refs and prefixes; Jekyll, Shopify and gem resolution on temp dirs; .. refused; completion filters; balanced and unbalanced blocks; the verbatim cases from review (lone {% in raw, raw in comment, doc, front matter); {% liquid %} statements; test/broken/bad.html.liquid via include_str!.
  • test/e2e.js: render → _card.liquid; Jekyll include; Shopify snippet render and completion; links, hover and completion; a diagnostic with its code; the Rails gate case kept.
  • test/cli.js: a broken .liquid file exits 1 with its code.
  • Results: 1020 Rust tests, test:server, e2e, cli, test:rules, test:tokens, test:unit, format:check, build and test:vscode (first round) pass.

Generated by Claude Code

Liquid had highlighting only. For 1.0 it gets what ERB, Haml and Slim
have: go to definition, links, hover and completion for render,
include and include_relative (Jekyll's _includes under _config.yml,
otherwise the liquid gem's _name.liquid next to the file), and errors
for unclosed {{ and {%, unclosed or stray block tags and mismatched
end tags, also in `ruby-templates check`. Liquid is no longer marked
experimental, and rubyTemplates.liquid.disabledDiagnostics switches
the new rules off in the editor.

Closes #98

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012jSfzj1UNFUHV9YmmbjLg4
Review found valid templates reported as broken: a lone `{%` inside
raw, raw inside comment, `{% doc %}` bodies and Jekyll front matter
were read as tags. Verbatim blocks now take their end tag as Liquid
does, comments honour raw, doc is verbatim and front matter is
skipped. A Shopify theme's renders resolve to snippets/, include names
with `..` resolve to nothing as in Jekyll, completion skips hidden and
dependency folders, `_config.yaml`/`.toml` mark a Jekyll site, and
`_name.liquid` wins over `_name.html.liquid` as in the gem.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012jSfzj1UNFUHV9YmmbjLg4
@x-ror
x-ror merged commit a02209e into main Nov 14, 2026
17 checks passed
@x-ror
x-ror deleted the feat/liquid-1.0 branch November 14, 2026 20:24
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

Successfully merging this pull request may close these issues.

feat: Liquid templates (grammar, render navigation, block diagnostics)

2 participants