✨ feat(mq-lang,mq-run): add descendant selectors, link/image URL filtering, and selector help fixes - #2200
Merged
Merged
Conversation
…ering, and selector help fixes
- `.a .b` selector chains now match `.b` nodes nested anywhere under `.a`
(sugar for `.a | .. | .b`), chainable to any depth and combinable with
selector-call filters and trailing attribute access.
- `.link("url")` / `.image("url")` selector calls filter by URL, matching
the existing `.code("lang")` pattern.
- `mq help` now documents call-arg params for every filterable selector,
and adds entries for `.callout`/`.wikilink`/`.embed`/`..`, which had none.
- Fix `.list`/`.[]` help text to match actual behavior (index-only filtering;
`checked` was never implemented, use `.task`/`.todo`/`.done` instead).
- Fix `mq help <name>` permanently hiding a same-named selector behind a
same-named module (`.table`/`table`, `.toml`/`toml`, `.yaml`/`yaml`);
both are now shown for human/markdown output, JSON stays module-only.
…e CST parser The CST parser (used by the formatter and LSP) still rejected `.a .b` descendant chains with UnexpectedToken after the AST parser learned to accept them, so `mq fmt`/editor tooling would flag valid queries as syntax errors. Mirror the AST parser's chain-building in the CST parser, and render the synthetic `..` bridge as a plain space so formatted output still matches what was typed (`.a.b` and `.a .b` both normalize to `.a .b`).
harehare
force-pushed
the
feat/selector-descendant-and-help-fixes
branch
from
August 14, 2026 13:35
b6f53bc to
caa498d
Compare
…dge node for descendant selector chains The CST parser represented a descendant chain's `.a .b` bridge as a synthetic `DoubleDot` child node reusing the following selector's source range, which shadowed that selector in range-based lookups (e.g. HIR/LSP hover on `.code` in `.blockquote .code` resolved to a phantom `..` symbol instead). Drop the synthetic node; the formatter now decides spacing by comparing the actual `Selector` kind of adjacent chain children instead of checking for the bridge token.
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.
Summary
.a .bselector chains now match.bnodes nested anywhere under.a(sugar for.a | .. | .b), chainable to any depth and combinable with selector-call filters and trailing attribute access..link("url")/.image("url")selector calls filter by URL, matching the existing.code("lang")pattern.mq helpnow documents call-arg params for every filterable selector, and adds entries for.callout/.wikilink/.embed/.., which had none..list/.[]help text to match actual behavior (index-only filtering;checkedwas never implemented, use.task/.todo/.doneinstead).mq help <name>permanently hiding a same-named selector behind a same-named module (.table/table,.toml/toml,.yaml/yaml); both are now shown for human/markdown output, JSON stays module-only.Type of Change
Checklist
cargo fmtandcargo clippyand addressed any warningsjust test-alland all tests pass/docs, crateREADME.md) if neededAdditional Context