diff options
| author | figsoda <figsoda@pm.me> | 2022-11-23 12:32:02 -0500 |
|---|---|---|
| committer | Stephan Seitz <stephan.seitz@fau.de> | 2022-11-24 00:13:12 +0100 |
| commit | 07674600c99e6775429e2f4c7dbee63e52ff17f0 (patch) | |
| tree | 79a0308a72e2fbf26fc24b5aad575c8abf21c4bb /queries/nix | |
| parent | highlights(nix): highlight parameters (diff) | |
| download | nvim-treesitter-07674600c99e6775429e2f4c7dbee63e52ff17f0.tar nvim-treesitter-07674600c99e6775429e2f4c7dbee63e52ff17f0.tar.gz nvim-treesitter-07674600c99e6775429e2f4c7dbee63e52ff17f0.tar.bz2 nvim-treesitter-07674600c99e6775429e2f4c7dbee63e52ff17f0.tar.lz nvim-treesitter-07674600c99e6775429e2f4c7dbee63e52ff17f0.tar.xz nvim-treesitter-07674600c99e6775429e2f4c7dbee63e52ff17f0.tar.zst nvim-treesitter-07674600c99e6775429e2f4c7dbee63e52ff17f0.zip | |
injections(nix): add injections for code blocks
based on https://github.com/cstrahan/tree-sitter-nix/pull/31
Diffstat (limited to 'queries/nix')
| -rw-r--r-- | queries/nix/injections.scm | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/queries/nix/injections.scm b/queries/nix/injections.scm index 4bb7d675d..e2fab69ff 100644 --- a/queries/nix/injections.scm +++ b/queries/nix/injections.scm @@ -1 +1,90 @@ (comment) @comment + +(binding + attrpath: (attrpath (identifier) @_path) + expression: [ + (string_expression (string_fragment) @bash) + (indented_string_expression (string_fragment) @bash) + ] + (#match? @_path "(^\\w*Phase|(pre|post)\\w*|(.*\\.)?\\w*([sS]cript|[hH]ook)|(.*\\.)?startup)$")) + +(apply_expression + function: (_) @_func + argument: (_ (_)* (_ (_)* (binding + attrpath: (attrpath (identifier) @_path) + expression: [ + (string_expression (string_fragment) @bash) + (indented_string_expression (string_fragment) @bash) + ]))) + (#match? @_func "(^|\\.)writeShellApplication$") + (#match? @_path "^text$")) + +(apply_expression + (apply_expression + function: (apply_expression function: (_) @_func) + argument: [ + (string_expression (string_fragment) @bash) + (indented_string_expression (string_fragment) @bash) + ]) + (#match? @_func "(^|\\.)runCommand(((No)?CC)?(Local)?)?$")) + +((apply_expression + function: (apply_expression function: (_) @_func) + argument: [ + (string_expression (string_fragment) @bash) + (indented_string_expression (string_fragment) @bash) + ]) + (#match? @_func "(^|\\.)write(Bash|Dash|ShellScript)(Bin)?$")) + +((apply_expression + function: (apply_expression function: (_) @_func) + argument: [ + (string_expression (string_fragment) @fish) + (indented_string_expression (string_fragment) @fish) + ]) + (#match? @_func "(^|\\.)writeFish(Bin)?$")) + +((apply_expression + function: (apply_expression + function: (apply_expression function: (_) @_func)) + argument: [ + (string_expression (string_fragment) @haskell) + (indented_string_expression (string_fragment) @haskell) + ]) + (#match? @_func "(^|\\.)writeHaskell(Bin)?$")) + +((apply_expression + function: (apply_expression + function: (apply_expression function: (_) @_func)) + argument: [ + (string_expression (string_fragment) @javascript) + (indented_string_expression (string_fragment) @javascript) + ]) + (#match? @_func "(^|\\.)writeJS(Bin)?$")) + +((apply_expression + function: (apply_expression + function: (apply_expression function: (_) @_func)) + argument: [ + (string_expression (string_fragment) @perl) + (indented_string_expression (string_fragment) @perl) + ]) + (#match? @_func "(^|\\.)writePerl(Bin)?$")) + +((apply_expression + function: (apply_expression + function: (apply_expression function: (_) @_func)) + argument: [ + (string_expression (string_fragment) @python) + (indented_string_expression (string_fragment) @python) + ]) + (#match? @_func "(^|\\.)write(PyPy|Python)[23](Bin)?$")) + +((apply_expression + function: (apply_expression + function: (apply_expression function: (_) @_func)) + argument: [ + (string_expression (string_fragment) @rust) + (indented_string_expression (string_fragment) @rust) + ]) + (#match? @_func "(^|\\.)writeRust(Bin)?$")) |
