Skip to content

Make class/enum query-capturable; Helix-compatible SPM queries - #55

Open
iliaskarim wants to merge 1 commit into
airbus-cert:mainfrom
iliaskarim:helix-compatible-spm-queries
Open

iliaskarim wants to merge 1 commit into
airbus-cert:mainfrom
iliaskarim:helix-compatible-spm-queries

Conversation

@iliaskarim

Copy link
Copy Markdown

Summary

  • Unwrap `token(reservedWord('class'|'enum'))` so tree-sitter queries can capture anonymous `"class"` / `"enum"` as keywords, and regenerate the parser.
  • Fix `Package.swift` to always include `src/scanner.c` (manifest-time path probe can drop it) and declare iOS/macOS platforms.
  • Replace `queries/highlights.scm` with Helix-compatible captures (`class`/`enum` as `@keyword`, plus a `command_name` fallback).

Why

Swift/Helix consumers cannot highlight `class`/`enum` as keywords while those words are wrapped in `token()`. Apps end up sed-patching `grammar.js` and post-processing Helix queries. Baking the grammar + query fixes into the SPM `queries/` bundle removes that.

Based on current `main` (`e7bd348`).

Test plan

  • `class Foo {}` / `enum Bar {}` parse as `class_statement` / `enum_statement`
  • `"class" @keyword` / `"enum" @keyword` match in highlights
  • SPM package builds with scanner symbols on iOS

Made with Cursor

Unwrap token(reservedWord('class'|'enum')) so anonymous keyword captures work, regenerate the parser, always include scanner.c in Package.swift, and promote Helix-style highlights into queries/.

Co-authored-by: Cursor <cursoragent@cursor.com>
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