Skip to content

Instantly share code, notes, and snippets.

@aral
Created September 2, 2022 09:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aral/789b0432d4c1a477d7dfd76826a6e43b to your computer and use it in GitHub Desktop.
Save aral/789b0432d4c1a477d7dfd76826a6e43b to your computer and use it in GitHub Desktop.
Kitten runtime queries for Helix Editor

Kitten tree sitter runtime queries for Helix Editor

Until these are in Helix proper, place these in your runtime/queries/kitten folder.

; inherits: javascript
; Highlight component names differently
(jsx_opening_element ((identifier) @constructor
(#match? @constructor "^[A-Z]")))
; Handle the dot operator effectively - <My.Component>
(jsx_opening_element ((nested_identifier (identifier) @tag (identifier) @constructor)))
(jsx_closing_element ((identifier) @constructor
(#match? @constructor "^[A-Z]")))
; Handle the dot operator effectively - </My.Component>
(jsx_closing_element ((nested_identifier (identifier) @tag (identifier) @constructor)))
(jsx_self_closing_element ((identifier) @constructor
(#match? @constructor "^[A-Z]")))
; Handle the dot operator effectively - <My.Component />
(jsx_self_closing_element ((nested_identifier (identifier) @tag (identifier) @constructor)))
; TODO: also tag @punctuation.delimiter?
(jsx_opening_element (identifier) @tag)
(jsx_closing_element (identifier) @tag)
(jsx_self_closing_element (identifier) @tag)
(jsx_attribute (property_identifier) @variable.other.member)
; inherits: javascript
; inherits: javascript
; inherits: javascript
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment