Skip to content

Commit 1ccc91d

Browse files
authored
feat(queries): Add Nix highlights.scm (#761)
1 parent c691835 commit 1ccc91d

File tree

1 file changed

+99
-0
lines changed

1 file changed

+99
-0
lines changed

queries/nix/highlights.scm

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
(comment) @comment
2+
3+
[
4+
"if"
5+
"then"
6+
"else"
7+
"let"
8+
"inherit"
9+
"in"
10+
"rec"
11+
"with"
12+
"assert"
13+
"or"
14+
] @keyword
15+
16+
((identifier) @variable.builtin
17+
(#match? @variable.builtin "^(__currentSystem|__currentTime|__nixPath|__nixVersion|__storeDir|builtins|false|null|true)$")
18+
(#is-not? local))
19+
20+
((identifier) @function.builtin
21+
(#match? @function.builtin "^(__add|__addErrorContext|__all|__any|__appendContext|__attrNames|__attrValues|__bitAnd|__bitOr|__bitXor|__catAttrs|__compareVersions|__concatLists|__concatMap|__concatStringsSep|__deepSeq|__div|__elem|__elemAt|__fetchurl|__filter|__filterSource|__findFile|__foldl'|__fromJSON|__functionArgs|__genList|__genericClosure|__getAttr|__getContext|__getEnv|__hasAttr|__hasContext|__hashFile|__hashString|__head|__intersectAttrs|__isAttrs|__isBool|__isFloat|__isFunction|__isInt|__isList|__isPath|__isString|__langVersion|__length|__lessThan|__listToAttrs|__mapAttrs|__match|__mul|__parseDrvName|__partition|__path|__pathExists|__readDir|__readFile|__replaceStrings|__seq|__sort|__split|__splitVersion|__storePath|__stringLength|__sub|__substring|__tail|__toFile|__toJSON|__toPath|__toXML|__trace|__tryEval|__typeOf|__unsafeDiscardOutputDependency|__unsafeDiscardStringContext|__unsafeGetAttrPos|__valueSize|abort|baseNameOf|derivation|derivationStrict|dirOf|fetchGit|fetchMercurial|fetchTarball|fromTOML|import|isNull|map|placeholder|removeAttrs|scopedImport|throw|toString)$")
22+
(#is-not? local))
23+
24+
[
25+
(integer_expression)
26+
(float_expression)
27+
] @number
28+
29+
(escape_sequence) @escape
30+
(dollar_escape) @escape
31+
32+
(function_expression
33+
universal: (identifier) @variable.parameter
34+
)
35+
36+
(formal
37+
name: (identifier) @variable.parameter
38+
"?"? @punctuation.delimiter)
39+
40+
(select_expression
41+
attrpath: (attrpath (identifier)) @property)
42+
43+
(apply_expression
44+
function: [
45+
(variable_expression (identifier)) @function
46+
(select_expression
47+
attrpath: (attrpath
48+
attr: (identifier) @function .))])
49+
50+
(unary_expression
51+
operator: _ @operator)
52+
53+
(binary_expression
54+
operator: _ @operator)
55+
56+
(variable_expression (identifier) @variable)
57+
58+
(binding
59+
attrpath: (attrpath (identifier)) @property)
60+
61+
(identifier) @property
62+
63+
(inherit_from attrs: (inherited_attrs attr: (identifier) @property) )
64+
65+
[
66+
";"
67+
"."
68+
","
69+
"="
70+
] @punctuation.delimiter
71+
72+
[
73+
"("
74+
")"
75+
"["
76+
"]"
77+
"{"
78+
"}"
79+
] @punctuation.bracket
80+
81+
(identifier) @variable
82+
83+
[
84+
(string_expression)
85+
(indented_string_expression)
86+
] @string
87+
88+
[
89+
(path_expression)
90+
(hpath_expression)
91+
(spath_expression)
92+
] @string.special.path
93+
94+
(uri_expression) @string.special.uri
95+
96+
(interpolation
97+
"${" @punctuation.special
98+
(_) @embedded
99+
"}" @punctuation.special)

0 commit comments

Comments
 (0)