fix(lxlquery): handle unclosed quotes + pills - #1647
Draft
jesperengstrom wants to merge 4 commits into
Draft
Conversation
jesperengstrom
force-pushed
the
fix-lxlquery-unclosed-quotes-in-qualifiers
branch
from
June 25, 2026 08:13
5acd5b9 to
5cc5f5a
Compare
Contributor
|
Seems to work fine now! 🙌 LGTM! |
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.
Description
Solves
Needs to be thoroughly tested…
An attempt to fix the fact that a single quote char can break the pill rendering:
This is of course because the
"makes everything up until the next quote parse as astrLiteral, swallowing the subsequent qualifier.We need to allow the stray
”to parse as something allowed inside a QualifierValue, in order for the qualifier to stay intact.If we add a new token for the incomplete quoted string,
StrliteralIncomplete, and include it in the definition ofString, it now "adds upp", allowing the rest to stay intact too. (a little deceiving, because it is in fact an invalid query)But we still have a problem:
The parser still sees the quoted string
” contribution:(”instead of an incomplete string and a qualifier.The only thing I've come up with is to disallow certain chars in quoted strings. When the parser sees
(), or():=~<>in a incomplete quoted string, it breaks and instead goes with the qualifier:Downsides / tradeoffs
More convoluted grammar
We lose the "error highlighting" of unclosed quotes, since it's now part of the grammar
Will probably never be 100% waterproof:
the query
" title:"hello"Will still be parsed as a the string literal
" title:"(as long as we don't disallow more chars here)This should only be merged in combination with a fix to make sure the api don't wipe groups () from the query. These are now key to recognizing qualifiers in these cases.
Summary of changes