aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRiley Bruins <ribru17@hotmail.com>2025-10-29 18:51:42 -0700
committerGitHub <noreply@github.com>2025-10-30 10:51:42 +0900
commit2c30e515ebe79037ab8d15f7e59c0e2690f50626 (patch)
tree9adff00656d8edd1329c841545e8b32d340f647f
parentfeat(diff): update parser after move (diff)
downloadnvim-treesitter-2c30e515ebe79037ab8d15f7e59c0e2690f50626.tar
nvim-treesitter-2c30e515ebe79037ab8d15f7e59c0e2690f50626.tar.gz
nvim-treesitter-2c30e515ebe79037ab8d15f7e59c0e2690f50626.tar.bz2
nvim-treesitter-2c30e515ebe79037ab8d15f7e59c0e2690f50626.tar.lz
nvim-treesitter-2c30e515ebe79037ab8d15f7e59c0e2690f50626.tar.xz
nvim-treesitter-2c30e515ebe79037ab8d15f7e59c0e2690f50626.tar.zst
nvim-treesitter-2c30e515ebe79037ab8d15f7e59c0e2690f50626.zip
fix: prefer `#eq?` for checking equality with one string (#8246)
-rw-r--r--.tsqueryrc.json4
-rw-r--r--runtime/queries/bass/highlights.scm2
-rw-r--r--runtime/queries/cmake/highlights.scm2
-rw-r--r--runtime/queries/janet_simple/highlights.scm2
-rw-r--r--runtime/queries/latex/highlights.scm2
-rw-r--r--runtime/queries/ninja/highlights.scm2
-rw-r--r--runtime/queries/slim/highlights.scm16
-rw-r--r--runtime/queries/systemverilog/highlights.scm2
-rw-r--r--runtime/queries/terraform/highlights.scm2
9 files changed, 19 insertions, 15 deletions
diff --git a/.tsqueryrc.json b/.tsqueryrc.json
index cd3a692d5..d146e2f76 100644
--- a/.tsqueryrc.json
+++ b/.tsqueryrc.json
@@ -187,6 +187,10 @@
},
{
"type": "string",
+ "arity": "required"
+ },
+ {
+ "type": "string",
"arity": "variadic"
}
],
diff --git a/runtime/queries/bass/highlights.scm b/runtime/queries/bass/highlights.scm
index f84993af1..8508de9ab 100644
--- a/runtime/queries/bass/highlights.scm
+++ b/runtime/queries/bass/highlights.scm
@@ -79,7 +79,7 @@
; Repeats
((symbol) @keyword.repeat
- (#any-of? @keyword.repeat "each"))
+ (#eq? @keyword.repeat "each"))
; Operators
((symbol) @operator
diff --git a/runtime/queries/cmake/highlights.scm b/runtime/queries/cmake/highlights.scm
index fbbf0d542..41713ea16 100644
--- a/runtime/queries/cmake/highlights.scm
+++ b/runtime/queries/cmake/highlights.scm
@@ -137,7 +137,7 @@
((argument) @_cache @keyword.modifier
.
(argument) @_type @type
- (#any-of? @_cache "CACHE")
+ (#eq? @_cache "CACHE")
(#any-of? @_type "BOOL" "FILEPATH" "PATH" "STRING" "INTERNAL"))))
(normal_command
diff --git a/runtime/queries/janet_simple/highlights.scm b/runtime/queries/janet_simple/highlights.scm
index 552f865c6..eb82a9830 100644
--- a/runtime/queries/janet_simple/highlights.scm
+++ b/runtime/queries/janet_simple/highlights.scm
@@ -55,7 +55,7 @@
; Comment
((sym_lit) @comment
- (#any-of? @comment "comment"))
+ (#eq? @comment "comment"))
; Special forms and builtin macros
;
diff --git a/runtime/queries/latex/highlights.scm b/runtime/queries/latex/highlights.scm
index 3f195a13e..06cb165e3 100644
--- a/runtime/queries/latex/highlights.scm
+++ b/runtime/queries/latex/highlights.scm
@@ -266,7 +266,7 @@
(begin
name: (curly_group_text
(text) @label)
- (#any-of? @label "frame"))
+ (#eq? @label "frame"))
.
(curly_group
(_) @markup.heading))
diff --git a/runtime/queries/ninja/highlights.scm b/runtime/queries/ninja/highlights.scm
index 8323ee9e9..6d3a110b6 100644
--- a/runtime/queries/ninja/highlights.scm
+++ b/runtime/queries/ninja/highlights.scm
@@ -55,7 +55,7 @@
; ========
(pool
name: (identifier) @type.builtin
- (#any-of? @type.builtin "console"))
+ (#eq? @type.builtin "console"))
(build
rule: (identifier) @function.builtin
diff --git a/runtime/queries/slim/highlights.scm b/runtime/queries/slim/highlights.scm
index e219932f6..f14ea864f 100644
--- a/runtime/queries/slim/highlights.scm
+++ b/runtime/queries/slim/highlights.scm
@@ -54,29 +54,29 @@
(#any-of? @markup.italic "i" "em"))
((tag_name) @markup.link
- (#any-of? @markup.link "a"))
+ (#eq? @markup.link "a"))
; Headings
((tag_name) @markup.heading
- (#any-of? @markup.heading "header"))
+ (#eq? @markup.heading "header"))
((tag_name) @markup.heading.1
- (#any-of? @markup.heading.1 "h1"))
+ (#eq? @markup.heading.1 "h1"))
((tag_name) @markup.heading.2
- (#any-of? @markup.heading.2 "h2"))
+ (#eq? @markup.heading.2 "h2"))
((tag_name) @markup.heading.3
- (#any-of? @markup.heading.3 "h3"))
+ (#eq? @markup.heading.3 "h3"))
((tag_name) @markup.heading.4
- (#any-of? @markup.heading.4 "h4"))
+ (#eq? @markup.heading.4 "h4"))
((tag_name) @markup.heading.5
- (#any-of? @markup.heading.5 "h5"))
+ (#eq? @markup.heading.5 "h5"))
((tag_name) @markup.heading.6
- (#any-of? @markup.heading.6 "h6"))
+ (#eq? @markup.heading.6 "h6"))
((tag_name) @markup.list
(#any-of? @markup.list "ul" "ol" "li" "dl" "dt" "dd"))
diff --git a/runtime/queries/systemverilog/highlights.scm b/runtime/queries/systemverilog/highlights.scm
index 21542941f..da251a6e4 100644
--- a/runtime/queries/systemverilog/highlights.scm
+++ b/runtime/queries/systemverilog/highlights.scm
@@ -327,7 +327,7 @@ port_name: (simple_identifier) @variable
(method_call_body
arguments: (list_of_arguments
(expression) @variable.builtin
- (#any-of? @variable.builtin "this")))
+ (#eq? @variable.builtin "this")))
(implicit_class_handle) @variable.builtin
diff --git a/runtime/queries/terraform/highlights.scm b/runtime/queries/terraform/highlights.scm
index a6bf83cdb..d4f5d8b53 100644
--- a/runtime/queries/terraform/highlights.scm
+++ b/runtime/queries/terraform/highlights.scm
@@ -27,7 +27,7 @@
(#eq? @type.builtin "terraform"))
(get_attr
(identifier) @variable.builtin
- (#any-of? @variable.builtin "workspace")))
+ (#eq? @variable.builtin "workspace")))
; Terraform specific keywords
; FIXME: ideally only for identifiers under a `variable` block to minimize false positives