Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--runtime/queries/nix/injections.scm16
1 files changed, 15 insertions, 1 deletions
diff --git a/runtime/queries/nix/injections.scm b/runtime/queries/nix/injections.scm
index ce53d39e..f9e0267b 100644
--- a/runtime/queries/nix/injections.scm
+++ b/runtime/queries/nix/injections.scm
@@ -255,4 +255,18 @@
(#set! injection.combined))
((indented_string_expression (string_fragment) @injection.shebang @injection.content)
- (#set! injection.combined)) \ No newline at end of file
+ (#set! injection.combined))
+
+; string contents of lib.literalExpression is nix code
+((apply_expression
+ function: [
+ (select_expression) ; `lib.literalExpression`
+ (variable_expression) ; `literalExpression` this is the case when the symbol is brougth into scope e.g. `let inherit (lib) literalExpression; in`
+ ] @_func
+ argument: [
+ (indented_string_expression (string_fragment) @injection.content) ; lib.literalExpression ''...''
+ (string_expression (string_fragment) @injection.content) ; lib.literalExpression "..."
+ ])
+ (#any-of? @_func "lib.literalExpression" "literalExpression")
+ (#set! injection.language "nix")
+ (#set! injection.combined))