mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 11:06:54 -04:00
fix: prefer #eq? for checking equality with one string (#8246)
This commit is contained in:
parent
9ddd853e7e
commit
2c30e515eb
9 changed files with 19 additions and 15 deletions
|
|
@ -185,6 +185,10 @@
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"arity": "required"
|
"arity": "required"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"arity": "required"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"arity": "variadic"
|
"arity": "variadic"
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@
|
||||||
|
|
||||||
; Repeats
|
; Repeats
|
||||||
((symbol) @keyword.repeat
|
((symbol) @keyword.repeat
|
||||||
(#any-of? @keyword.repeat "each"))
|
(#eq? @keyword.repeat "each"))
|
||||||
|
|
||||||
; Operators
|
; Operators
|
||||||
((symbol) @operator
|
((symbol) @operator
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@
|
||||||
((argument) @_cache @keyword.modifier
|
((argument) @_cache @keyword.modifier
|
||||||
.
|
.
|
||||||
(argument) @_type @type
|
(argument) @_type @type
|
||||||
(#any-of? @_cache "CACHE")
|
(#eq? @_cache "CACHE")
|
||||||
(#any-of? @_type "BOOL" "FILEPATH" "PATH" "STRING" "INTERNAL"))))
|
(#any-of? @_type "BOOL" "FILEPATH" "PATH" "STRING" "INTERNAL"))))
|
||||||
|
|
||||||
(normal_command
|
(normal_command
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@
|
||||||
|
|
||||||
; Comment
|
; Comment
|
||||||
((sym_lit) @comment
|
((sym_lit) @comment
|
||||||
(#any-of? @comment "comment"))
|
(#eq? @comment "comment"))
|
||||||
|
|
||||||
; Special forms and builtin macros
|
; Special forms and builtin macros
|
||||||
;
|
;
|
||||||
|
|
|
||||||
|
|
@ -266,7 +266,7 @@
|
||||||
(begin
|
(begin
|
||||||
name: (curly_group_text
|
name: (curly_group_text
|
||||||
(text) @label)
|
(text) @label)
|
||||||
(#any-of? @label "frame"))
|
(#eq? @label "frame"))
|
||||||
.
|
.
|
||||||
(curly_group
|
(curly_group
|
||||||
(_) @markup.heading))
|
(_) @markup.heading))
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@
|
||||||
; ========
|
; ========
|
||||||
(pool
|
(pool
|
||||||
name: (identifier) @type.builtin
|
name: (identifier) @type.builtin
|
||||||
(#any-of? @type.builtin "console"))
|
(#eq? @type.builtin "console"))
|
||||||
|
|
||||||
(build
|
(build
|
||||||
rule: (identifier) @function.builtin
|
rule: (identifier) @function.builtin
|
||||||
|
|
|
||||||
|
|
@ -54,29 +54,29 @@
|
||||||
(#any-of? @markup.italic "i" "em"))
|
(#any-of? @markup.italic "i" "em"))
|
||||||
|
|
||||||
((tag_name) @markup.link
|
((tag_name) @markup.link
|
||||||
(#any-of? @markup.link "a"))
|
(#eq? @markup.link "a"))
|
||||||
|
|
||||||
; Headings
|
; Headings
|
||||||
((tag_name) @markup.heading
|
((tag_name) @markup.heading
|
||||||
(#any-of? @markup.heading "header"))
|
(#eq? @markup.heading "header"))
|
||||||
|
|
||||||
((tag_name) @markup.heading.1
|
((tag_name) @markup.heading.1
|
||||||
(#any-of? @markup.heading.1 "h1"))
|
(#eq? @markup.heading.1 "h1"))
|
||||||
|
|
||||||
((tag_name) @markup.heading.2
|
((tag_name) @markup.heading.2
|
||||||
(#any-of? @markup.heading.2 "h2"))
|
(#eq? @markup.heading.2 "h2"))
|
||||||
|
|
||||||
((tag_name) @markup.heading.3
|
((tag_name) @markup.heading.3
|
||||||
(#any-of? @markup.heading.3 "h3"))
|
(#eq? @markup.heading.3 "h3"))
|
||||||
|
|
||||||
((tag_name) @markup.heading.4
|
((tag_name) @markup.heading.4
|
||||||
(#any-of? @markup.heading.4 "h4"))
|
(#eq? @markup.heading.4 "h4"))
|
||||||
|
|
||||||
((tag_name) @markup.heading.5
|
((tag_name) @markup.heading.5
|
||||||
(#any-of? @markup.heading.5 "h5"))
|
(#eq? @markup.heading.5 "h5"))
|
||||||
|
|
||||||
((tag_name) @markup.heading.6
|
((tag_name) @markup.heading.6
|
||||||
(#any-of? @markup.heading.6 "h6"))
|
(#eq? @markup.heading.6 "h6"))
|
||||||
|
|
||||||
((tag_name) @markup.list
|
((tag_name) @markup.list
|
||||||
(#any-of? @markup.list "ul" "ol" "li" "dl" "dt" "dd"))
|
(#any-of? @markup.list "ul" "ol" "li" "dl" "dt" "dd"))
|
||||||
|
|
|
||||||
|
|
@ -327,7 +327,7 @@ port_name: (simple_identifier) @variable
|
||||||
(method_call_body
|
(method_call_body
|
||||||
arguments: (list_of_arguments
|
arguments: (list_of_arguments
|
||||||
(expression) @variable.builtin
|
(expression) @variable.builtin
|
||||||
(#any-of? @variable.builtin "this")))
|
(#eq? @variable.builtin "this")))
|
||||||
|
|
||||||
(implicit_class_handle) @variable.builtin
|
(implicit_class_handle) @variable.builtin
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
(#eq? @type.builtin "terraform"))
|
(#eq? @type.builtin "terraform"))
|
||||||
(get_attr
|
(get_attr
|
||||||
(identifier) @variable.builtin
|
(identifier) @variable.builtin
|
||||||
(#any-of? @variable.builtin "workspace")))
|
(#eq? @variable.builtin "workspace")))
|
||||||
|
|
||||||
; Terraform specific keywords
|
; Terraform specific keywords
|
||||||
; FIXME: ideally only for identifiers under a `variable` block to minimize false positives
|
; FIXME: ideally only for identifiers under a `variable` block to minimize false positives
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue