mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-20 20:30:05 -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
|
|
@ -22,10 +22,10 @@
|
|||
(comment) @comment
|
||||
|
||||
; strings
|
||||
[ (string) (indented_string) ] @string
|
||||
[ (string_expression) (indented_string_expression) ] @string
|
||||
|
||||
; paths and URLs
|
||||
[ (path) (spath) (uri) ] @string.special
|
||||
[ (path_expression) (spath_expression) (uri_expression) ] @string.special
|
||||
|
||||
; escape sequences
|
||||
(escape_sequence) @string.escape
|
||||
|
|
@ -55,16 +55,18 @@
|
|||
(ellipses) @punctuation.special
|
||||
|
||||
; `:` in `x: y`, used to separate function argument from body (see above)
|
||||
(function ":" @punctuation.special)
|
||||
(function_expression ":" @punctuation.special)
|
||||
|
||||
; basic identifiers
|
||||
(identifier) @variable
|
||||
(variable_expression) @variable
|
||||
|
||||
; builtin functions
|
||||
((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)
|
||||
(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
|
||||
((identifier) @_i (#eq? @_i "import")) @include
|
||||
|
|
@ -82,39 +84,23 @@
|
|||
(interpolation "${" @punctuation.special (_) "}" @punctuation.special) @none
|
||||
|
||||
; fields (the `.` in `a.b = c;` isn't included)
|
||||
(attrset (bind . (attrpath (attr_identifier) @field)))
|
||||
(rec_attrset (bind . (attrpath (attr_identifier) @field)))
|
||||
(attrset_expression (binding_set (binding . (attrpath (identifier) @field))))
|
||||
(rec_attrset_expression (binding_set (binding . (attrpath (identifier) @field))))
|
||||
|
||||
; unary operators
|
||||
(unary "-" @operator)
|
||||
(unary "!" @operator)
|
||||
(unary_expression operator: _ @operator)
|
||||
|
||||
; binary operators
|
||||
(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)
|
||||
(binary "->" @operator)
|
||||
(binary_expression operator: _ @operator)
|
||||
|
||||
; integers, also highlight a unary -
|
||||
[
|
||||
(unary "-" (integer))
|
||||
(integer)
|
||||
(unary_expression "-" (integer_expression))
|
||||
(integer_expression)
|
||||
] @number
|
||||
|
||||
; floats, also highlight a unary -
|
||||
[
|
||||
(unary "-" (float))
|
||||
(float)
|
||||
(unary_expression "-" (float_expression))
|
||||
(float_expression)
|
||||
] @float
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue