nvim-treesitter/queries/nix/injections.scm
Pham Huy Hoang 78b54eb7f6 chore(injections)!: update injection syntax to 0.9
Since 0.9, @lang syntax is still available as fallback but will soon be deprecated.
Because of that, new syntax should be adopted once 0.9 becomes the
baseline requirements for nvim-treesitter

- update health check
- update doc
2023-08-12 17:34:15 +02:00

131 lines
4.5 KiB
Scheme

((comment) @injection.content
(#set! injection.language "comment"))
(apply_expression
function: (_) @_func
argument: [
(string_expression
((string_fragment) @injection.content (#set! injection.language "regex")))
(indented_string_expression
((string_fragment) @injection.content (#set! injection.language "regex")))
]
(#match? @_func "(^|\\.)match$")
(#set! injection.combined))
(binding
attrpath: (attrpath (identifier) @_path)
expression: [
(string_expression
((string_fragment) @injection.content (#set! injection.language "bash")))
(indented_string_expression
((string_fragment) @injection.content (#set! injection.language "bash")))
]
(#match? @_path "(^\\w+(Phase|Hook)|(pre|post)[A-Z]\\w+|script)$"))
(apply_expression
function: (_) @_func
argument: (_ (_)* (_ (_)* (binding
attrpath: (attrpath (identifier) @_path)
expression: [
(string_expression
((string_fragment) @injection.content (#set! injection.language "bash")))
(indented_string_expression
((string_fragment) @injection.content (#set! injection.language "bash")))
])))
(#match? @_func "(^|\\.)writeShellApplication$")
(#match? @_path "^text$")
(#set! injection.combined))
(apply_expression
function: (apply_expression
function: (apply_expression function: (_) @_func))
argument: [
(string_expression
((string_fragment) @injection.content (#set! injection.language "bash")))
(indented_string_expression
((string_fragment) @injection.content (#set! injection.language "bash")))
]
(#match? @_func "(^|\\.)runCommand((No)?CC)?(Local)?$")
(#set! injection.combined))
((apply_expression
function: (apply_expression function: (_) @_func)
argument: [
(string_expression
((string_fragment) @injection.content (#set! injection.language "bash")))
(indented_string_expression
((string_fragment) @injection.content (#set! injection.language "bash")))
])
(#match? @_func "(^|\\.)write(Bash|Dash|ShellScript)(Bin)?$")
(#set! injection.combined))
((apply_expression
function: (apply_expression function: (_) @_func)
argument: [
(string_expression
((string_fragment) @injection.content (#set! injection.language "fish")))
(indented_string_expression
((string_fragment) @injection.content (#set! injection.language "fish")))
])
(#match? @_func "(^|\\.)writeFish(Bin)?$")
(#set! injection.combined))
((apply_expression
function: (apply_expression
function: (apply_expression function: (_) @_func))
argument: [
(string_expression
((string_fragment) @injection.content (#set! injection.language "haskell")))
(indented_string_expression
((string_fragment) @injection.content (#set! injection.language "haskell")))
])
(#match? @_func "(^|\\.)writeHaskell(Bin)?$")
(#set! injection.combined))
((apply_expression
function: (apply_expression
function: (apply_expression function: (_) @_func))
argument: [
(string_expression
((string_fragment) @injection.content (#set! injection.language "javascript")))
(indented_string_expression
((string_fragment) @injection.content (#set! injection.language "javascript")))
])
(#match? @_func "(^|\\.)writeJS(Bin)?$")
(#set! injection.combined))
((apply_expression
function: (apply_expression
function: (apply_expression function: (_) @_func))
argument: [
(string_expression
((string_fragment) @injection.content (#set! injection.language "perl")))
(indented_string_expression
((string_fragment) @injection.content (#set! injection.language "perl")))
])
(#match? @_func "(^|\\.)writePerl(Bin)?$")
(#set! injection.combined))
((apply_expression
function: (apply_expression
function: (apply_expression function: (_) @_func))
argument: [
(string_expression
((string_fragment) @injection.content (#set! injection.language "python")))
(indented_string_expression
((string_fragment) @injection.content (#set! injection.language "python")))
])
(#match? @_func "(^|\\.)write(PyPy|Python)[23](Bin)?$")
(#set! injection.combined))
((apply_expression
function: (apply_expression
function: (apply_expression function: (_) @_func))
argument: [
(string_expression
((string_fragment) @injection.content (#set! injection.language "rust")))
(indented_string_expression
((string_fragment) @injection.content (#set! injection.language "rust")))
])
(#match? @_func "(^|\\.)writeRust(Bin)?$")
(#set! injection.combined))