Skip to content

Commit

Permalink
nix: fix highlights
Browse files Browse the repository at this point in the history
The `@` is now highlighted properly on either side of the function arg.

Also, extending the phases with `buildPhase = prev.buildPhase + ''''`
is now highlighted properly.

Fix highlighting of `''$` style escapes
  • Loading branch information
nrdxp committed Sep 30, 2022
1 parent 37aa9e4 commit b1affae
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions runtime/queries/nix/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@
(float_expression) @constant.numeric.float

(escape_sequence) @constant.character.escape
(dollar_escape) @constant.character.escape

(function_expression
"@"? @punctuation.delimiter
universal: (identifier) @variable.parameter
"@"? @punctuation.delimiter
)
Expand Down
8 changes: 5 additions & 3 deletions runtime/queries/nix/injections.scm
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@

((binding
attrpath: (attrpath (identifier) @_path)
expression: (indented_string_expression
(string_fragment) @injection.content))
(#match? @_path "(^\\w*Phase|(pre|post)\\w*|(.*\\.)?\\w*([sS]cript|[hH]ook)|(.*\\.)?startup)$")
expression: [
(indented_string_expression (string_fragment) @injection.content)
(binary_expression (indented_string_expression (string_fragment) @injection.content))
])
(#match? @_path "(^\\w*Phase|command|(pre|post)\\w*|(.*\\.)?\\w*([sS]cript|[hH]ook)|(.*\\.)?startup)$")
(#set! injection.language "bash")
(#set! injection.combined))

Expand Down

0 comments on commit b1affae

Please sign in to comment.