injections(nix): combine injections to work better with interpolations

This commit is contained in:
figsoda 2022-12-03 16:33:50 -05:00 committed by Stephan Seitz
parent 668dec2903
commit 06989a933e
2 changed files with 13 additions and 1 deletions

View file

@ -33,7 +33,8 @@
(comment) @comment (comment) @comment
; strings ; strings
[ (string_expression) (indented_string_expression) ] @string ([ (string_expression) (indented_string_expression) ]
(#set! "priority" 99)) @string
; paths and URLs ; paths and URLs
[ (path_expression) (spath_expression) (uri_expression) ] @string.special [ (path_expression) (spath_expression) (uri_expression) ] @string.special

View file

@ -7,6 +7,7 @@
(indented_string_expression (string_fragment) @regex) (indented_string_expression (string_fragment) @regex)
] ]
(#match? @_func "(^|\\.)match$")) (#match? @_func "(^|\\.)match$"))
@combined
(binding (binding
attrpath: (attrpath (identifier) @_path) attrpath: (attrpath (identifier) @_path)
@ -15,6 +16,7 @@
(indented_string_expression (string_fragment) @bash) (indented_string_expression (string_fragment) @bash)
] ]
(#match? @_path "(^\\w*Phase|(pre|post)\\w*|(.*\\.)?\\w*([sS]cript|[hH]ook)|(.*\\.)?startup)$")) (#match? @_path "(^\\w*Phase|(pre|post)\\w*|(.*\\.)?\\w*([sS]cript|[hH]ook)|(.*\\.)?startup)$"))
@combined
(apply_expression (apply_expression
function: (_) @_func function: (_) @_func
@ -26,6 +28,7 @@
]))) ])))
(#match? @_func "(^|\\.)writeShellApplication$") (#match? @_func "(^|\\.)writeShellApplication$")
(#match? @_path "^text$")) (#match? @_path "^text$"))
@combined
(apply_expression (apply_expression
function: (apply_expression function: (apply_expression
@ -35,6 +38,7 @@
(indented_string_expression (string_fragment) @bash) (indented_string_expression (string_fragment) @bash)
] ]
(#match? @_func "(^|\\.)runCommand((No)?CC)?(Local)?$")) (#match? @_func "(^|\\.)runCommand((No)?CC)?(Local)?$"))
@combined
((apply_expression ((apply_expression
function: (apply_expression function: (_) @_func) function: (apply_expression function: (_) @_func)
@ -43,6 +47,7 @@
(indented_string_expression (string_fragment) @bash) (indented_string_expression (string_fragment) @bash)
]) ])
(#match? @_func "(^|\\.)write(Bash|Dash|ShellScript)(Bin)?$")) (#match? @_func "(^|\\.)write(Bash|Dash|ShellScript)(Bin)?$"))
@combined
((apply_expression ((apply_expression
function: (apply_expression function: (_) @_func) function: (apply_expression function: (_) @_func)
@ -51,6 +56,7 @@
(indented_string_expression (string_fragment) @fish) (indented_string_expression (string_fragment) @fish)
]) ])
(#match? @_func "(^|\\.)writeFish(Bin)?$")) (#match? @_func "(^|\\.)writeFish(Bin)?$"))
@combined
((apply_expression ((apply_expression
function: (apply_expression function: (apply_expression
@ -60,6 +66,7 @@
(indented_string_expression (string_fragment) @haskell) (indented_string_expression (string_fragment) @haskell)
]) ])
(#match? @_func "(^|\\.)writeHaskell(Bin)?$")) (#match? @_func "(^|\\.)writeHaskell(Bin)?$"))
@combined
((apply_expression ((apply_expression
function: (apply_expression function: (apply_expression
@ -69,6 +76,7 @@
(indented_string_expression (string_fragment) @javascript) (indented_string_expression (string_fragment) @javascript)
]) ])
(#match? @_func "(^|\\.)writeJS(Bin)?$")) (#match? @_func "(^|\\.)writeJS(Bin)?$"))
@combined
((apply_expression ((apply_expression
function: (apply_expression function: (apply_expression
@ -78,6 +86,7 @@
(indented_string_expression (string_fragment) @perl) (indented_string_expression (string_fragment) @perl)
]) ])
(#match? @_func "(^|\\.)writePerl(Bin)?$")) (#match? @_func "(^|\\.)writePerl(Bin)?$"))
@combined
((apply_expression ((apply_expression
function: (apply_expression function: (apply_expression
@ -87,6 +96,7 @@
(indented_string_expression (string_fragment) @python) (indented_string_expression (string_fragment) @python)
]) ])
(#match? @_func "(^|\\.)write(PyPy|Python)[23](Bin)?$")) (#match? @_func "(^|\\.)write(PyPy|Python)[23](Bin)?$"))
@combined
((apply_expression ((apply_expression
function: (apply_expression function: (apply_expression
@ -96,3 +106,4 @@
(indented_string_expression (string_fragment) @rust) (indented_string_expression (string_fragment) @rust)
]) ])
(#match? @_func "(^|\\.)writeRust(Bin)?$")) (#match? @_func "(^|\\.)writeRust(Bin)?$"))
@combined