feat(highlight): migrate to tree-house with Helix queries
Replace tree-sitter-highlight dep with tree-house crate from Helix editor. Add ropey dependency required by tree-house. Reorganize query files from Helix's runtime/queries/ for all 14 supported languages: - bash, c, css, go, html, javascript, json, markdown, nix, python, rust, toml, typescript, yaml - Include ecma, _javascript, _typescript base dirs for JS/TS inheritance - Copy highlights.scm, injections.scm, locals.scm where available This commit establishes the foundation; highlight.rs implementation will follow in subsequent commits.
This commit is contained in:
36
queries/_javascript/highlights.scm
Normal file
36
queries/_javascript/highlights.scm
Normal file
@@ -0,0 +1,36 @@
|
||||
; Function and method parameters
|
||||
;-------------------------------
|
||||
|
||||
; Javascript and Typescript Treesitter grammars deviate when defining the
|
||||
; tree structure for parameters, so we need to address them in each specific
|
||||
; language instead of ecma.
|
||||
|
||||
; (p)
|
||||
(formal_parameters
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
; (...p)
|
||||
(formal_parameters
|
||||
(rest_pattern
|
||||
(identifier) @variable.parameter))
|
||||
|
||||
; ({ p })
|
||||
(formal_parameters
|
||||
(object_pattern
|
||||
(shorthand_property_identifier_pattern) @variable.parameter))
|
||||
|
||||
; ({ a: p })
|
||||
(formal_parameters
|
||||
(object_pattern
|
||||
(pair_pattern
|
||||
value: (identifier) @variable.parameter)))
|
||||
|
||||
; ([ p ])
|
||||
(formal_parameters
|
||||
(array_pattern
|
||||
(identifier) @variable.parameter))
|
||||
|
||||
; (p = 1)
|
||||
(formal_parameters
|
||||
(assignment_pattern
|
||||
left: (identifier) @variable.parameter))
|
||||
14
queries/_javascript/locals.scm
Normal file
14
queries/_javascript/locals.scm
Normal file
@@ -0,0 +1,14 @@
|
||||
; Definitions
|
||||
;------------
|
||||
; Javascript and Typescript Treesitter grammars deviate when defining the
|
||||
; tree structure for parameters, so we need to address them in each specific
|
||||
; language instead of ecma.
|
||||
|
||||
; (i)
|
||||
(formal_parameters
|
||||
(identifier) @local.definition.variable.parameter)
|
||||
|
||||
; (i = 1)
|
||||
(formal_parameters
|
||||
(assignment_pattern
|
||||
left: (identifier) @local.definition.variable.parameter))
|
||||
Reference in New Issue
Block a user