nix: fix highlighting rules

* avoid coloring `identifier`s globally
* fix function application when not part of `select_expression`
* add `has_attribute_expression` highlighting
* fix precendence for interpolation, which should be after select
* highlight `@` as delimiter
pull/3729/head
Timothy DeHerrera 2 years ago committed by Michael Davis
parent b7380313a5
commit 1fe32737fa

@ -1,16 +1,20 @@
(comment) @comment (comment) @comment
"assert" @keyword.control.exception
"or" @keyword.operator
"rec" @keyword.control.repeat
[ [
"if" "if"
"then" "then"
"else" "else"
] @keyword.control.conditional
[
"let" "let"
"inherit" "inherit"
"in" "in"
"rec"
"with" "with"
"assert"
"or"
] @keyword ] @keyword
((identifier) @variable.builtin ((identifier) @variable.builtin
@ -42,14 +46,11 @@
(integer_expression) @constant.numeric.integer (integer_expression) @constant.numeric.integer
(float_expression) @constant.numeric.float (float_expression) @constant.numeric.float
(interpolation
"${" @punctuation.special
"}" @punctuation.special) @embedded
(escape_sequence) @constant.character.escape (escape_sequence) @constant.character.escape
(function_expression (function_expression
universal: (identifier) @variable.parameter universal: (identifier) @variable.parameter
"@"? @punctuation.delimiter
) )
(formal (formal
@ -57,11 +58,15 @@
"?"? @punctuation.delimiter) "?"? @punctuation.delimiter)
(select_expression (select_expression
attrpath: (attrpath (identifier)) @variable.other.member) attrpath: (attrpath attr: (identifier)) @variable.other.member)
(interpolation
"${" @punctuation.special
"}" @punctuation.special) @embedded
(apply_expression (apply_expression
function: [ function: [
(variable_expression (identifier)) @function (variable_expression name: (identifier) @function)
(select_expression (select_expression
attrpath: (attrpath attrpath: (attrpath
attr: (identifier) @function .))]) attr: (identifier) @function .))])
@ -72,14 +77,18 @@
(binary_expression (binary_expression
operator: _ @operator) operator: _ @operator)
(variable_expression (identifier) @variable) (variable_expression name: (identifier) @variable)
(binding (binding
attrpath: (attrpath (identifier)) @variable.other.member) attrpath: (attrpath attr: (identifier)) @variable.other.member)
(identifier) @variable.other.member (inherit_from attrs: (inherited_attrs attr: (identifier) @variable))
(inherit_from attrs: (inherited_attrs attr: (identifier) @variable.other.member) ) (has_attr_expression
expression: (_)
"?" @operator
attrpath: (attrpath
attr: (identifier) @variable.other.member))
[ [
";" ";"

Loading…
Cancel
Save