queries: inject nix into `lib.literalExression` string contents (#13851)

pull/13344/head^2
Kristoffer Plagborg Bak Sørensen 2025-06-29 00:00:58 +02:00 committed by GitHub
parent d654a07d3d
commit f75d71844f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 1 deletions

View File

@ -255,4 +255,18 @@
(#set! injection.combined)) (#set! injection.combined))
((indented_string_expression (string_fragment) @injection.shebang @injection.content) ((indented_string_expression (string_fragment) @injection.shebang @injection.content)
(#set! injection.combined)) (#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))