mirror of
https://github.com/chenasraf/nvim-treesitter.git
synced 2026-05-17 17:38:02 +00:00
fix: prefer #eq? for checking equality with one string (#8246)
This commit is contained in:
@@ -185,6 +185,10 @@
|
||||
"type": "string",
|
||||
"arity": "required"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"arity": "required"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"arity": "variadic"
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
|
||||
; Repeats
|
||||
((symbol) @keyword.repeat
|
||||
(#any-of? @keyword.repeat "each"))
|
||||
(#eq? @keyword.repeat "each"))
|
||||
|
||||
; Operators
|
||||
((symbol) @operator
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
|
||||
; Comment
|
||||
((sym_lit) @comment
|
||||
(#any-of? @comment "comment"))
|
||||
(#eq? @comment "comment"))
|
||||
|
||||
; Special forms and builtin macros
|
||||
;
|
||||
|
||||
@@ -266,7 +266,7 @@
|
||||
(begin
|
||||
name: (curly_group_text
|
||||
(text) @label)
|
||||
(#any-of? @label "frame"))
|
||||
(#eq? @label "frame"))
|
||||
.
|
||||
(curly_group
|
||||
(_) @markup.heading))
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
; ========
|
||||
(pool
|
||||
name: (identifier) @type.builtin
|
||||
(#any-of? @type.builtin "console"))
|
||||
(#eq? @type.builtin "console"))
|
||||
|
||||
(build
|
||||
rule: (identifier) @function.builtin
|
||||
|
||||
@@ -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"))
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user