aboutsummaryrefslogtreecommitdiffstats
path: root/queries/nix
diff options
context:
space:
mode:
authorPham Huy Hoang <hoangtun0810@gmail.com>2023-05-03 19:07:59 +0900
committerChristian Clason <c.clason@uni-graz.at>2023-08-12 17:34:15 +0200
commit78b54eb7f6a9956d25a3911fa0dfd0cabfe2a4c5 (patch)
tree87bc9ffd574b406ceaeb4ea4c32290e66145f587 /queries/nix
parentfeat!: bump required Nvim version to 0.9.1 (diff)
downloadnvim-treesitter-78b54eb7f6a9956d25a3911fa0dfd0cabfe2a4c5.tar
nvim-treesitter-78b54eb7f6a9956d25a3911fa0dfd0cabfe2a4c5.tar.gz
nvim-treesitter-78b54eb7f6a9956d25a3911fa0dfd0cabfe2a4c5.tar.bz2
nvim-treesitter-78b54eb7f6a9956d25a3911fa0dfd0cabfe2a4c5.tar.lz
nvim-treesitter-78b54eb7f6a9956d25a3911fa0dfd0cabfe2a4c5.tar.xz
nvim-treesitter-78b54eb7f6a9956d25a3911fa0dfd0cabfe2a4c5.tar.zst
nvim-treesitter-78b54eb7f6a9956d25a3911fa0dfd0cabfe2a4c5.zip
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
Diffstat (limited to 'queries/nix')
-rw-r--r--queries/nix/injections.scm109
1 files changed, 66 insertions, 43 deletions
diff --git a/queries/nix/injections.scm b/queries/nix/injections.scm
index 671f93185..2b5d55ec1 100644
--- a/queries/nix/injections.scm
+++ b/queries/nix/injections.scm
@@ -1,19 +1,24 @@
-(comment) @comment
+((comment) @injection.content
+ (#set! injection.language "comment"))
(apply_expression
function: (_) @_func
argument: [
- (string_expression (string_fragment) @regex)
- (indented_string_expression (string_fragment) @regex)
+ (string_expression
+ ((string_fragment) @injection.content (#set! injection.language "regex")))
+ (indented_string_expression
+ ((string_fragment) @injection.content (#set! injection.language "regex")))
]
- (#match? @_func "(^|\\.)match$"))
- @combined
+ (#match? @_func "(^|\\.)match$")
+ (#set! injection.combined))
(binding
attrpath: (attrpath (identifier) @_path)
expression: [
- (string_expression (string_fragment) @bash)
- (indented_string_expression (string_fragment) @bash)
+ (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)$"))
@@ -22,87 +27,105 @@
argument: (_ (_)* (_ (_)* (binding
attrpath: (attrpath (identifier) @_path)
expression: [
- (string_expression (string_fragment) @bash)
- (indented_string_expression (string_fragment) @bash)
+ (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$"))
- @combined
+ (#match? @_path "^text$")
+ (#set! injection.combined))
(apply_expression
function: (apply_expression
function: (apply_expression function: (_) @_func))
argument: [
- (string_expression (string_fragment) @bash)
- (indented_string_expression (string_fragment) @bash)
+ (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)?$"))
- @combined
+ (#match? @_func "(^|\\.)runCommand((No)?CC)?(Local)?$")
+ (#set! injection.combined))
((apply_expression
function: (apply_expression function: (_) @_func)
argument: [
- (string_expression (string_fragment) @bash)
- (indented_string_expression (string_fragment) @bash)
+ (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)?$"))
- @combined
+ (#match? @_func "(^|\\.)write(Bash|Dash|ShellScript)(Bin)?$")
+ (#set! injection.combined))
((apply_expression
function: (apply_expression function: (_) @_func)
argument: [
- (string_expression (string_fragment) @fish)
- (indented_string_expression (string_fragment) @fish)
+ (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)?$"))
- @combined
+ (#match? @_func "(^|\\.)writeFish(Bin)?$")
+ (#set! injection.combined))
((apply_expression
function: (apply_expression
function: (apply_expression function: (_) @_func))
argument: [
- (string_expression (string_fragment) @haskell)
- (indented_string_expression (string_fragment) @haskell)
+ (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)?$"))
- @combined
+ (#match? @_func "(^|\\.)writeHaskell(Bin)?$")
+ (#set! injection.combined))
((apply_expression
function: (apply_expression
function: (apply_expression function: (_) @_func))
argument: [
- (string_expression (string_fragment) @javascript)
- (indented_string_expression (string_fragment) @javascript)
+ (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)?$"))
- @combined
+ (#match? @_func "(^|\\.)writeJS(Bin)?$")
+ (#set! injection.combined))
((apply_expression
function: (apply_expression
function: (apply_expression function: (_) @_func))
argument: [
- (string_expression (string_fragment) @perl)
- (indented_string_expression (string_fragment) @perl)
+ (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)?$"))
- @combined
+ (#match? @_func "(^|\\.)writePerl(Bin)?$")
+ (#set! injection.combined))
((apply_expression
function: (apply_expression
function: (apply_expression function: (_) @_func))
argument: [
- (string_expression (string_fragment) @python)
- (indented_string_expression (string_fragment) @python)
+ (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)?$"))
- @combined
+ (#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) @rust)
- (indented_string_expression (string_fragment) @rust)
+ (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)?$"))
- @combined
+ (#match? @_func "(^|\\.)writeRust(Bin)?$")
+ (#set! injection.combined))