feat(nix): add writeText/writeTextDir injection

This commit is contained in:
Lương Việt Hoàng 2026-03-22 20:35:04 +07:00
parent 539abf6da5
commit 4a53f4cb18
2 changed files with 55 additions and 0 deletions

View file

@ -255,6 +255,48 @@
(#lua-match? @_func "^%a*%.*writeRust%a*$")
(#set! injection.combined))
((apply_expression
function: (apply_expression
function: (_) @_func
argument: [
(string_expression
.
(string_fragment) @injection.filename .)
(indented_string_expression
.
(string_fragment) @injection.filename .)
])
. ; only match on adjacent text, so that we can use a comment to change the language
argument: [
(string_expression
(string_fragment) @injection.content)
(indented_string_expression
(string_fragment) @injection.content)
])
(#lua-match? @_func "^%a*%.*writeText$")
(#set! injection.combined))
((apply_expression
function: (apply_expression
function: (_) @_func
argument: [
(string_expression
.
(string_fragment) @injection.filename .)
(indented_string_expression
.
(string_fragment) @injection.filename .)
])
. ; only match on adjacent text, so that we can use a comment to change the language
argument: [
(string_expression
(string_fragment) @injection.content)
(indented_string_expression
(string_fragment) @injection.content)
])
(#lua-match? @_func "^%a*%.*writeTextDir$")
(#set! injection.combined))
; (runTest) testScript
(apply_expression
function: (_) @_func

View file

@ -70,6 +70,19 @@ in {
'';
};
drv13 = pkgs.writeText "config.json" ''
{
"foo": 1,
"bar": 2
}
'';
drv14 = pkgs.writeTextDir "etc/ssh/ssh_config" ''
Host *
AddressFamily any
ForwardX11 no
'';
mod1 = {
type = "lua";
config = ''