mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-15 01:40:02 -04:00
perf: remove match where possible
This commit is contained in:
parent
654216eb04
commit
85330918f0
37 changed files with 104 additions and 113 deletions
|
|
@ -3,10 +3,10 @@
|
|||
; Tags that start with a lower case letter are HTML tags
|
||||
; We'll also use this highlighting for named blocks (which start with `:`)
|
||||
((tag_name) @tag
|
||||
(#match? @tag "^(:)?[a-z]"))
|
||||
(#lua-match? @tag "^:?[%l]"))
|
||||
; Tags that start with a capital letter are Glimmer components
|
||||
((tag_name) @constructor
|
||||
(#lua-match? @constructor "^[A-Z]"))
|
||||
(#lua-match? @constructor "^%u"))
|
||||
|
||||
(attribute_name) @property
|
||||
|
||||
|
|
@ -38,7 +38,7 @@
|
|||
(path_expression (identifier) @variable)
|
||||
(identifier) @variable
|
||||
])
|
||||
(#not-match? @variable "yield|outlet|this|else"))
|
||||
(#not-any-of? @variable "yield" "outlet" "this" "else"))
|
||||
; As are arguments in a block statement
|
||||
(block_statement_start argument: [
|
||||
(path_expression (identifier) @variable)
|
||||
|
|
@ -51,10 +51,10 @@
|
|||
(path_expression (identifier) @variable)
|
||||
(identifier) @variable
|
||||
])
|
||||
(#not-match? @variable "this"))
|
||||
(#not-eq? @variable "this"))
|
||||
; `this` should be highlighted as a built-in variable
|
||||
((identifier) @variable.builtin
|
||||
(#lua-match? @variable.builtin "this"))
|
||||
(#eq? @variable.builtin "this"))
|
||||
|
||||
; If the identifier is just "yield" or "outlet", it's a keyword
|
||||
((mustache_statement (identifier) @keyword)
|
||||
|
|
@ -65,11 +65,11 @@
|
|||
(path_expression (identifier) @function)
|
||||
(identifier) @function
|
||||
])
|
||||
(#not-match? @function "if|yield"))
|
||||
(#not-any-of? @function "if" "yield"))
|
||||
((helper_invocation helper: (identifier) @conditional)
|
||||
(#lua-match? @conditional "if"))
|
||||
(#eq? @conditional "if"))
|
||||
((helper_invocation helper: (identifier) @keyword)
|
||||
(#lua-match? @keyword "yield"))
|
||||
(#eq? @keyword "yield"))
|
||||
|
||||
(hash_pair key: (identifier) @property)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue