mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-05 04:50:03 -04:00
fix(nix): highlight functions when part of a set (#7547)
* feat(nix): Fix function highlights when part of a set * fix(nix): Highlight only the last identifier node in functions * fix(nix): Higher precedence for builtins compared to functions and member vars
This commit is contained in:
parent
1c77042243
commit
4d93fae5a3
1 changed files with 38 additions and 26 deletions
|
|
@ -90,6 +90,44 @@
|
|||
name: (identifier) @boolean
|
||||
(#any-of? @boolean "true" "false"))
|
||||
|
||||
; string interpolation (this was very annoying to get working properly)
|
||||
(interpolation
|
||||
"${" @punctuation.special
|
||||
(_)
|
||||
"}" @punctuation.special) @none
|
||||
|
||||
(select_expression
|
||||
expression: (_) @_expr
|
||||
attrpath: (attrpath
|
||||
attr: (identifier) @variable.member)
|
||||
(#not-eq? @_expr "builtins"))
|
||||
|
||||
(attrset_expression
|
||||
(binding_set
|
||||
(binding
|
||||
.
|
||||
(attrpath
|
||||
(identifier) @variable.member))))
|
||||
|
||||
(rec_attrset_expression
|
||||
(binding_set
|
||||
(binding
|
||||
.
|
||||
(attrpath
|
||||
(identifier) @variable.member))))
|
||||
|
||||
(apply_expression
|
||||
function: [
|
||||
(select_expression
|
||||
attrpath: (attrpath
|
||||
.
|
||||
attr: (identifier) @function.call .))
|
||||
(select_expression
|
||||
attrpath: (attrpath
|
||||
(_)
|
||||
attr: (identifier) @function.call .))
|
||||
])
|
||||
|
||||
; builtin functions (with builtins prefix)
|
||||
(select_expression
|
||||
expression: (variable_expression
|
||||
|
|
@ -138,32 +176,6 @@
|
|||
; nix eval --impure --expr 'with builtins; filter (x: !(isFunction builtins.${x} || isBool builtins.${x})) (attrNames builtins)'
|
||||
"builtins" "currentSystem" "currentTime" "langVersion" "nixPath" "nixVersion" "null" "storeDir"))
|
||||
|
||||
; string interpolation (this was very annoying to get working properly)
|
||||
(interpolation
|
||||
"${" @punctuation.special
|
||||
(_)
|
||||
"}" @punctuation.special) @none
|
||||
|
||||
(select_expression
|
||||
expression: (_) @_expr
|
||||
attrpath: (attrpath
|
||||
attr: (identifier) @variable.member)
|
||||
(#not-eq? @_expr "builtins"))
|
||||
|
||||
(attrset_expression
|
||||
(binding_set
|
||||
(binding
|
||||
.
|
||||
(attrpath
|
||||
(identifier) @variable.member))))
|
||||
|
||||
(rec_attrset_expression
|
||||
(binding_set
|
||||
(binding
|
||||
.
|
||||
(attrpath
|
||||
(identifier) @variable.member))))
|
||||
|
||||
; function definition
|
||||
(binding
|
||||
attrpath: (attrpath
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue