Skip to content

fix(queries): fold aggregate option values, highlight reserved names - #36

Open
stefanvanburen wants to merge 1 commit into
mainfrom
fix/query-gaps-fold-block-lit-highlight-reserved
Open

fix(queries): fold aggregate option values, highlight reserved names#36
stefanvanburen wants to merge 1 commit into
mainfrom
fix/query-gaps-fold-block-lit-highlight-reserved

Conversation

@stefanvanburen

@stefanvanburen stefanvanburen commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Two query-only gaps, both left over from the query pass in #32. No grammar or parser changes.

block_lit was indentable but not foldable

#32 added block_lit as an indent.begin, but it was never added to folds.scm — so a multi-line aggregate option value indented correctly and then couldn't be folded. Every other brace-delimited body in the grammar is foldable.

Before, on a message containing a multi-line option value, the fold query captured the enclosing message and a nested enum but nothing for the option body. Now:

capture: fold, start: (1, 0), end: (7, 1)   ← message
capture: fold, start: (2, 21), end: (5, 3)  ← block_lit  (new)
capture: fold, start: (6, 2), end: (6, 19)  ← enum

reserved "foo"; had no highlight at all

Reserved names parse as reserved_identifier, which is its own node type rather than (string), so no rule matched them. Only the reserved keyword and the ; were captured — reserved names were the one literal in the grammar that rendered as plain unstyled text, while every other string in the file was highlighted.

(reserved_identifier) @string

Verification

tree-sitter test  →  38/38 parses, 0 failures, 70 highlight assertions

Three new highlight assertions cover the reserved-name case (67 → 70).


Bottom of a 2-PR stack. Non-breaking and independent — it can merge on its own.


Stack created with GitHub Stacks CLIGive Feedback 💬

Two gaps left over from the query pass in #32, both query-only.

- block_lit became an indent.begin in #32 but was never added to folds,
  so a multi-line aggregate option value indented correctly and then
  could not be folded. Every other brace-delimited body is foldable.

- reserved "foo"; produced no highlight at all. Reserved names parse as
  reserved_identifier, which is its own node type rather than (string),
  so no rule matched them - they were the only literal in the grammar
  that rendered as plain text. Three highlight assertions now cover it.
@stefanvanburen
stefanvanburen marked this pull request as ready for review August 31, 2026 22:48
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