Support string enums in LiquidDoc parameter types - #1315
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
charlespwd
changed the base branch from
liquiddoc-string-literal-unions
to
main
September 30, 2026 18:50
charlespwd
commented
Sep 30, 2026
charlespwd
force-pushed
the
cp-liquiddoc-enum-review-fixes
branch
from
September 30, 2026 19:47
2bcf0d1 to
733e4ec
Compare
charlespwd
commented
Sep 30, 2026
charlespwd
force-pushed
the
cp-liquiddoc-enum-review-fixes
branch
2 times, most recently
from
September 30, 2026 20:18
26558be to
6b6f2d0
Compare
charlespwd
marked this pull request as ready for review
September 30, 2026 20:19
charlespwd
force-pushed
the
cp-liquiddoc-enum-review-fixes
branch
from
September 30, 2026 20:29
6b6f2d0 to
d662f4f
Compare
clauderic
approved these changes
Sep 30, 2026
charlespwd
force-pushed
the
cp-liquiddoc-enum-review-fixes
branch
from
September 30, 2026 20:40
d662f4f to
27eb283
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In this PR
Add string enums to LiquidDoc parameter types:
{% doc %} @param {'heading' | 'small'} [variant] - Text style {% enddoc %}The parser preserves these declarations, Theme Check validates literal arguments against them, and the language server carries the allowed values through direct references, assignments, hovers, documentation, and completions.
Inspired by Claudéric's #1310. This PR carries the full feature independently and includes the parser and validation simplifications from reviewing that work.
Problem
LiquidDoc parameter types only represented named types and arrays. There was no way to document a finite set of string values, validate callers against those values, or preserve those choices as the language server inferred variables.
Quoted braces add one parser constraint: a
}inside a closed string such as'a}b'belongs to the string. Incomplete quoted types should remain unparsed rather than guessing a boundary from the parameter name or description.Solution
Parser and type model
}appears outside a quote, close the type.}as the invalid type boundary so semantic validation can reject it.Theme Check
@paramdeclarations.render, includingwithandforaliases,content_for, andblock.checkArgumentTyperesult for compatible, incompatible, named, and unchecked arguments.Language server
render,content_for, andblockparameter completions.defaultfilter results to the fallback type, with documented string enums widening tostring. General union and discriminated-union type math remain out of scope.General named-type unions such as
{product | collection}and discriminated unions remain follow-up work.