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
; strings
[ (string_expression) (indented_string_expression) ] @string
([ (string_expression) (indented_string_expression) ]
(#set! "priority" 99)) @string
; paths and URLs
[ (path_expression) (spath_expression) (uri_expression) ] @string.special

View file

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