diff options
| -rw-r--r-- | queries/nix/highlights.scm | 64 |
1 files changed, 38 insertions, 26 deletions
diff --git a/queries/nix/highlights.scm b/queries/nix/highlights.scm index 7cdcc3e1d..785d249b9 100644 --- a/queries/nix/highlights.scm +++ b/queries/nix/highlights.scm @@ -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 |
