mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
fix(lua): update queries
This commit is contained in:
parent
824b063d0d
commit
22f73628f6
2 changed files with 21 additions and 28 deletions
|
|
@ -3,16 +3,16 @@
|
|||
;;; Builtins
|
||||
;; Keywords
|
||||
"local" @keyword
|
||||
"if" @keyword
|
||||
"then" @keyword
|
||||
"else" @keyword
|
||||
"elseif" @keyword
|
||||
"if" @conditional
|
||||
"then" @conditional
|
||||
"else" @conditional
|
||||
"elseif" @conditional
|
||||
"end" @keyword
|
||||
"return" @keyword
|
||||
"do" @keyword
|
||||
"while" @keyword
|
||||
"repeat" @keyword
|
||||
"for" @keyword
|
||||
"do" @repeat
|
||||
"while" @repeat
|
||||
"repeat" @repeat
|
||||
"for" @repeat
|
||||
(break_statement) @keyword
|
||||
"goto" @keyword
|
||||
|
||||
|
|
@ -43,15 +43,16 @@
|
|||
"#" @operator
|
||||
|
||||
;; Constants
|
||||
(false) @constant
|
||||
(true) @constant
|
||||
(nil) @constant
|
||||
(false) @boolean
|
||||
(true) @boolean
|
||||
(nil) @constant.builtin
|
||||
(spread) @constant ;; "..."
|
||||
|
||||
;; Nodes
|
||||
(function "function" @function "end" @function)
|
||||
(function_definition "function" @function "end" @function)
|
||||
(local_function "function" @function "end" @function)
|
||||
(table "{" @operator "}" @operator)
|
||||
(table "{" @constructor "}" @constructor)
|
||||
(comment) @comment
|
||||
(string) @string
|
||||
(number) @number
|
||||
|
|
|
|||
|
|
@ -2,25 +2,20 @@
|
|||
|
||||
;; Variable and field declarations
|
||||
((variable_declarator
|
||||
(identifier) @definition)
|
||||
(set! definition.kind "v"))
|
||||
(identifier) @definition.var))
|
||||
|
||||
((variable_declarator
|
||||
(field_expression object:(*) @definition.associated (property_identifier) @definition))
|
||||
(set! difinition.kind "v"))
|
||||
(field_expression object:(*) @definition.associated (property_identifier) @definition.var)))
|
||||
|
||||
;; Parameters
|
||||
((local_function
|
||||
(parameters (identifier) @definition))
|
||||
(set! definition.kind "v"))
|
||||
(parameters (identifier) @definition.var)))
|
||||
((function
|
||||
(parameters (identifier) @definition))
|
||||
(set! definition.kind "v"))
|
||||
(parameters (identifier) @definition.var)))
|
||||
|
||||
;; Loops
|
||||
((loop_expression
|
||||
(identifier) @definition)
|
||||
(set! definition.kind "v"))
|
||||
(identifier) @definition.var))
|
||||
|
||||
;; Function definitions
|
||||
;; Functions definitions creates both a definition and a new scope
|
||||
|
|
@ -28,16 +23,13 @@
|
|||
(function_name
|
||||
(function_name_field
|
||||
(identifier) @definition.associated
|
||||
(property_identifier) @definition))) @scope
|
||||
(set! definition.kind "m"))
|
||||
(property_identifier) @definition.method))) @scope)
|
||||
|
||||
((function
|
||||
(function_name (identifier) @definition)) @scope
|
||||
(set! definition.kind "f"))
|
||||
(function_name (identifier) @definition.function)) @scope)
|
||||
|
||||
((local_function
|
||||
(identifier) @definition) @scope
|
||||
(set! definition.kind "f"))
|
||||
(identifier) @definition.function) @scope)
|
||||
|
||||
((if_statement) @scope)
|
||||
((for_in_statement) @scope)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue