aboutsummaryrefslogtreecommitdiff
path: root/runtime/queries
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/queries')
-rw-r--r--runtime/queries/markdown/injections.scm4
-rw-r--r--runtime/queries/nix/highlights.scm5
-rw-r--r--runtime/queries/nix/injections.scm18
3 files changed, 23 insertions, 4 deletions
diff --git a/runtime/queries/markdown/injections.scm b/runtime/queries/markdown/injections.scm
index e8839351..80977459 100644
--- a/runtime/queries/markdown/injections.scm
+++ b/runtime/queries/markdown/injections.scm
@@ -1,6 +1,10 @@
; From nvim-treesitter/nvim-treesitter
(fenced_code_block
+ (code_fence_content) @injection.shebang @injection.content
+ (#set! injection.include-unnamed-children))
+
+(fenced_code_block
(info_string
(language) @injection.language)
(code_fence_content) @injection.content (#set! injection.include-unnamed-children))
diff --git a/runtime/queries/nix/highlights.scm b/runtime/queries/nix/highlights.scm
index a998aa64..4633e178 100644
--- a/runtime/queries/nix/highlights.scm
+++ b/runtime/queries/nix/highlights.scm
@@ -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
)
@@ -82,7 +84,8 @@
(binding
attrpath: (attrpath attr: (identifier)) @variable.other.member)
-(inherit_from attrs: (inherited_attrs attr: (identifier) @variable))
+(inherit_from attrs: (inherited_attrs attr: (identifier) @variable.other.member))
+(inherited_attrs attr: (identifier) @variable)
(has_attr_expression
expression: (_)
diff --git a/runtime/queries/nix/injections.scm b/runtime/queries/nix/injections.scm
index 62b48233..1da63ce0 100644
--- a/runtime/queries/nix/injections.scm
+++ b/runtime/queries/nix/injections.scm
@@ -10,9 +10,11 @@
; such as those of stdenv.mkDerivation.
((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))
@@ -150,3 +152,13 @@
; (#match? @_func "(^|\\.)writeFSharp(Bin)?$")
; (#set! injection.language "f-sharp")
; (#set! injection.combined))
+
+((apply_expression
+ function: (apply_expression function: (_) @_func
+ argument: (string_expression (string_fragment) @injection.filename))
+ argument: (indented_string_expression (string_fragment) @injection.content))
+ (#match? @_func "(^|\\.)write(Text|Script(Bin)?)$")
+ (#set! injection.combined))
+
+((indented_string_expression (string_fragment) @injection.shebang @injection.content)
+ (#set! injection.combined)) \ No newline at end of file