Skip to content

✨ feat(mq-lang,mq-run): add descendant selectors, link/image URL filtering, and selector help fixes - #2200

Merged
harehare merged 3 commits into
mainfrom
feat/selector-descendant-and-help-fixes
Aug 15, 2026
Merged

✨ feat(mq-lang,mq-run): add descendant selectors, link/image URL filtering, and selector help fixes#2200
harehare merged 3 commits into
mainfrom
feat/selector-descendant-and-help-fixes

Conversation

@harehare

Copy link
Copy Markdown
Owner

Summary

  • .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.

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • ♻️ Refactor
  • 📝 Documentation
  • ⚡ Performance
  • ✅ Test
  • 📦 Build / dependencies
  • 👷 CI

Checklist

  • I ran cargo fmt and cargo clippy and addressed any warnings
  • I ran just test-all and all tests pass
  • I added or updated tests covering this change
  • I updated relevant documentation (/docs, crate README.md) if needed
  • I added a changelog entry if this is a user-facing change

Additional Context

…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.
@codspeed-hq

codspeed-hq Bot commented Aug 14, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing feat/selector-descendant-and-help-fixes (0a6204f) with main (b825b51)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (b536ca8) during the generation of this report, so b825b51 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

…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
harehare force-pushed the feat/selector-descendant-and-help-fixes branch from b6f53bc to caa498d Compare August 14, 2026 13:35
…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.
@harehare
harehare merged commit c6b8019 into main Aug 15, 2026
12 checks passed
@harehare
harehare deleted the feat/selector-descendant-and-help-fixes branch August 15, 2026 22:35
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.

1 participant