mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-19 11:50:09 -04:00
fix(nix): update parser and queries
This commit is contained in:
parent
3e0cc6b872
commit
29b0ea8093
4 changed files with 29 additions and 43 deletions
|
|
@ -198,7 +198,7 @@
|
||||||
"revision": "0a95cfdc0745b6ae82f60d3a339b37f19b7b9267"
|
"revision": "0a95cfdc0745b6ae82f60d3a339b37f19b7b9267"
|
||||||
},
|
},
|
||||||
"nix": {
|
"nix": {
|
||||||
"revision": "6d6aaa50793b8265b6a8b6628577a0083d3b923d"
|
"revision": "6b71a810c0acd49b980c50fc79092561f7cee307"
|
||||||
},
|
},
|
||||||
"norg": {
|
"norg": {
|
||||||
"revision": "17d61df817c1e0a9cdef8d915d4e4c556b7cf68c"
|
"revision": "17d61df817c1e0a9cdef8d915d4e4c556b7cf68c"
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
; Nix doesn't really have blocks, so just guess what people might want folds for
|
; Nix doesn't really have blocks, so just guess what people might want folds for
|
||||||
[
|
[
|
||||||
(if)
|
(if_expression)
|
||||||
(with)
|
(with_expression)
|
||||||
(let)
|
(let_expression)
|
||||||
(function)
|
(function_expression)
|
||||||
(attrset)
|
(attrset_expression)
|
||||||
(rec_attrset)
|
(rec_attrset_expression)
|
||||||
(list)
|
(list_expression)
|
||||||
(indented_string)
|
(indented_string_expression)
|
||||||
] @fold
|
] @fold
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,10 @@
|
||||||
(comment) @comment
|
(comment) @comment
|
||||||
|
|
||||||
; strings
|
; strings
|
||||||
[ (string) (indented_string) ] @string
|
[ (string_expression) (indented_string_expression) ] @string
|
||||||
|
|
||||||
; paths and URLs
|
; paths and URLs
|
||||||
[ (path) (spath) (uri) ] @string.special
|
[ (path_expression) (spath_expression) (uri_expression) ] @string.special
|
||||||
|
|
||||||
; escape sequences
|
; escape sequences
|
||||||
(escape_sequence) @string.escape
|
(escape_sequence) @string.escape
|
||||||
|
|
@ -55,16 +55,18 @@
|
||||||
(ellipses) @punctuation.special
|
(ellipses) @punctuation.special
|
||||||
|
|
||||||
; `:` in `x: y`, used to separate function argument from body (see above)
|
; `:` in `x: y`, used to separate function argument from body (see above)
|
||||||
(function ":" @punctuation.special)
|
(function_expression ":" @punctuation.special)
|
||||||
|
|
||||||
; basic identifiers
|
; basic identifiers
|
||||||
(identifier) @variable
|
(variable_expression) @variable
|
||||||
|
|
||||||
; builtin functions
|
; builtin functions
|
||||||
((identifier) @_i (#match? @_i "^(builtins|baseNameOf|dirOf|fetchTarball|map|removeAttrs|toString)$")) @variable.builtin
|
((identifier) @_i (#match? @_i "^(builtins|baseNameOf|dirOf|fetchTarball|map|removeAttrs|toString)$")) @variable.builtin
|
||||||
|
|
||||||
; display entire builtins path as builtin (ex. `builtins.filter` is highlighted as one long builtin)
|
; display entire builtins path as builtin (ex. `builtins.filter` is highlighted as one long builtin)
|
||||||
(select ((identifier) @_i (#eq? @_i "builtins")) (attrpath (attr_identifier) @variable.builtin)) @variable.builtin
|
(select_expression
|
||||||
|
expression: ((variable_expression) @_i (#eq? @_i "builtins"))
|
||||||
|
attrpath: (attrpath attr: (identifier) @variable.builtin)) @variable.builtin
|
||||||
|
|
||||||
; import
|
; import
|
||||||
((identifier) @_i (#eq? @_i "import")) @include
|
((identifier) @_i (#eq? @_i "import")) @include
|
||||||
|
|
@ -82,39 +84,23 @@
|
||||||
(interpolation "${" @punctuation.special (_) "}" @punctuation.special) @none
|
(interpolation "${" @punctuation.special (_) "}" @punctuation.special) @none
|
||||||
|
|
||||||
; fields (the `.` in `a.b = c;` isn't included)
|
; fields (the `.` in `a.b = c;` isn't included)
|
||||||
(attrset (bind . (attrpath (attr_identifier) @field)))
|
(attrset_expression (binding_set (binding . (attrpath (identifier) @field))))
|
||||||
(rec_attrset (bind . (attrpath (attr_identifier) @field)))
|
(rec_attrset_expression (binding_set (binding . (attrpath (identifier) @field))))
|
||||||
|
|
||||||
; unary operators
|
; unary operators
|
||||||
(unary "-" @operator)
|
(unary_expression operator: _ @operator)
|
||||||
(unary "!" @operator)
|
|
||||||
|
|
||||||
; binary operators
|
; binary operators
|
||||||
(binary "?" @operator)
|
(binary_expression operator: _ @operator)
|
||||||
(binary "++" @operator)
|
|
||||||
(binary "*" @operator)
|
|
||||||
(binary "/" @operator)
|
|
||||||
(binary "+" @operator)
|
|
||||||
(binary "-" @operator)
|
|
||||||
(binary "//" @operator)
|
|
||||||
(binary "<" @operator)
|
|
||||||
(binary "<=" @operator)
|
|
||||||
(binary ">" @operator)
|
|
||||||
(binary ">=" @operator)
|
|
||||||
(binary "==" @operator)
|
|
||||||
(binary "!=" @operator)
|
|
||||||
(binary "&&" @operator)
|
|
||||||
(binary "||" @operator)
|
|
||||||
(binary "->" @operator)
|
|
||||||
|
|
||||||
; integers, also highlight a unary -
|
; integers, also highlight a unary -
|
||||||
[
|
[
|
||||||
(unary "-" (integer))
|
(unary_expression "-" (integer_expression))
|
||||||
(integer)
|
(integer_expression)
|
||||||
] @number
|
] @number
|
||||||
|
|
||||||
; floats, also highlight a unary -
|
; floats, also highlight a unary -
|
||||||
[
|
[
|
||||||
(unary "-" (float))
|
(unary_expression "-" (float_expression))
|
||||||
(float)
|
(float_expression)
|
||||||
] @float
|
] @float
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
; let bindings
|
; let bindings
|
||||||
(let (bind . (attrpath) @definition.var)) @scope
|
(let_expression (binding_set (binding . (attrpath) @definition.var))) @scope
|
||||||
|
|
||||||
; rec attrsets
|
; rec attrsets
|
||||||
(rec_attrset (bind . (attrpath) @definition.field)) @scope
|
(rec_attrset_expression (binding_set (binding . (attrpath) @definition.field))) @scope
|
||||||
|
|
||||||
; functions and parameters
|
; functions and parameters
|
||||||
(function . [
|
(function_expression . [
|
||||||
(identifier) @definition.parameter
|
(identifier) @definition.parameter
|
||||||
(formals (formal . (identifier) @definition.parameter))
|
(formals (formal . (identifier) @definition.parameter))
|
||||||
]) @scope
|
]) @scope
|
||||||
((formals) "@" (identifier) @definition.parameter) ; I couldn't get this to work properly inside the (function)
|
((formals) "@" (identifier) @definition.parameter) ; I couldn't get this to work properly inside the (function)
|
||||||
|
|
||||||
; some identifiers can't be references, but @reference doesn't seem to have an inverse like @none
|
(variable_expression (identifier) @reference)
|
||||||
(identifier) @reference
|
(inherited_attrs attr: (identifier) @reference)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue