mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 10:45:16 -07:00
fix(treesitter): update parsers and queries
This commit is contained in:
parent
73de98256c
commit
39a0e6bf3c
@ -55,7 +55,7 @@ TREESITTER_PYTHON_URL https://github.com/tree-sitter/tree-sitter-python/archive/
|
||||
TREESITTER_PYTHON_SHA256 720304a603271fa89e4430a14d6a81a023d6d7d1171b1533e49c0ab44f1e1c13
|
||||
TREESITTER_BASH_URL https://github.com/tree-sitter/tree-sitter-bash/archive/v0.21.0.tar.gz
|
||||
TREESITTER_BASH_SHA256 f0515efda839cfede851adb24ac154227fbc0dfb60c6c11595ecfa9087d43ceb
|
||||
TREESITTER_MARKDOWN_URL https://github.com/MDeiml/tree-sitter-markdown/archive/v0.2.1.tar.gz
|
||||
TREESITTER_MARKDOWN_SHA256 d5dee1f57807a633062d03e19ad59d9b5e28f882da1ebe69a2e31f1df5b308ca
|
||||
TREESITTER_MARKDOWN_URL https://github.com/MDeiml/tree-sitter-markdown/archive/v0.2.3.tar.gz
|
||||
TREESITTER_MARKDOWN_SHA256 4909d6023643f1afc3ab219585d4035b7403f3a17849782ab803c5f73c8a31d5
|
||||
TREESITTER_URL https://github.com/tree-sitter/tree-sitter/archive/v0.22.2.tar.gz
|
||||
TREESITTER_SHA256 0c829523b876d4a37e1bd46a655c133a93669c0fe98fcd84972b168849c27afc
|
||||
|
@ -124,10 +124,15 @@
|
||||
(test_operator) @operator
|
||||
|
||||
(command_substitution
|
||||
"$(" @punctuation.bracket)
|
||||
"$(" @punctuation.special
|
||||
")" @punctuation.special)
|
||||
|
||||
(process_substitution
|
||||
"<(" @punctuation.bracket)
|
||||
[
|
||||
"<("
|
||||
">("
|
||||
] @punctuation.special
|
||||
")" @punctuation.special)
|
||||
|
||||
(arithmetic_expansion
|
||||
[
|
||||
@ -170,12 +175,11 @@
|
||||
"trap" "type" "typeset" "ulimit" "umask" "unalias" "wait"))
|
||||
|
||||
(command
|
||||
argument:
|
||||
[
|
||||
(word) @variable.parameter
|
||||
(concatenation
|
||||
(word) @variable.parameter)
|
||||
])
|
||||
argument: [
|
||||
(word) @variable.parameter
|
||||
(concatenation
|
||||
(word) @variable.parameter)
|
||||
])
|
||||
|
||||
(number) @number
|
||||
|
||||
|
@ -142,9 +142,6 @@
|
||||
|
||||
(char_literal) @character
|
||||
|
||||
((preproc_arg) @function.macro
|
||||
(#set! "priority" 90))
|
||||
|
||||
(preproc_defined) @function.macro
|
||||
|
||||
((field_expression
|
||||
@ -263,18 +260,16 @@
|
||||
function: (identifier) @function.call)
|
||||
|
||||
(call_expression
|
||||
function:
|
||||
(field_expression
|
||||
field: (field_identifier) @function.call))
|
||||
function: (field_expression
|
||||
field: (field_identifier) @function.call))
|
||||
|
||||
(function_declarator
|
||||
declarator: (identifier) @function)
|
||||
|
||||
(function_declarator
|
||||
declarator:
|
||||
(parenthesized_declarator
|
||||
(pointer_declarator
|
||||
declarator: (field_identifier) @function)))
|
||||
declarator: (parenthesized_declarator
|
||||
(pointer_declarator
|
||||
declarator: (field_identifier) @function)))
|
||||
|
||||
(preproc_function_def
|
||||
name: (identifier) @function.macro)
|
||||
|
@ -180,27 +180,24 @@
|
||||
(vararg_expression) @variable.parameter.builtin
|
||||
|
||||
(function_declaration
|
||||
name:
|
||||
[
|
||||
(identifier) @function
|
||||
(dot_index_expression
|
||||
field: (identifier) @function)
|
||||
])
|
||||
name: [
|
||||
(identifier) @function
|
||||
(dot_index_expression
|
||||
field: (identifier) @function)
|
||||
])
|
||||
|
||||
(function_declaration
|
||||
name:
|
||||
(method_index_expression
|
||||
method: (identifier) @function.method))
|
||||
name: (method_index_expression
|
||||
method: (identifier) @function.method))
|
||||
|
||||
(assignment_statement
|
||||
(variable_list
|
||||
.
|
||||
name:
|
||||
[
|
||||
(identifier) @function
|
||||
(dot_index_expression
|
||||
field: (identifier) @function)
|
||||
])
|
||||
name: [
|
||||
(identifier) @function
|
||||
(dot_index_expression
|
||||
field: (identifier) @function)
|
||||
])
|
||||
(expression_list
|
||||
.
|
||||
value: (function_definition)))
|
||||
@ -211,14 +208,13 @@
|
||||
value: (function_definition)))
|
||||
|
||||
(function_call
|
||||
name:
|
||||
[
|
||||
(identifier) @function.call
|
||||
(dot_index_expression
|
||||
field: (identifier) @function.call)
|
||||
(method_index_expression
|
||||
method: (identifier) @function.method.call)
|
||||
])
|
||||
name: [
|
||||
(identifier) @function.call
|
||||
(dot_index_expression
|
||||
field: (identifier) @function.call)
|
||||
(method_index_expression
|
||||
method: (identifier) @function.method.call)
|
||||
])
|
||||
|
||||
(function_call
|
||||
(identifier) @function.builtin
|
||||
@ -253,21 +249,19 @@
|
||||
(dot_index_expression
|
||||
field: (identifier) @_method
|
||||
(#any-of? @_method "find" "match" "gmatch" "gsub"))
|
||||
arguments:
|
||||
(arguments
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(string
|
||||
content: (string_content) @string.regexp)))
|
||||
arguments: (arguments
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(string
|
||||
content: (string_content) @string.regexp)))
|
||||
|
||||
;("123"):match("%d+")
|
||||
(function_call
|
||||
(method_index_expression
|
||||
method: (identifier) @_method
|
||||
(#any-of? @_method "find" "match" "gmatch" "gsub"))
|
||||
arguments:
|
||||
(arguments
|
||||
.
|
||||
(string
|
||||
content: (string_content) @string.regexp)))
|
||||
arguments: (arguments
|
||||
.
|
||||
(string
|
||||
content: (string_content) @string.regexp)))
|
||||
|
@ -1,67 +1,69 @@
|
||||
((function_call
|
||||
name:
|
||||
[
|
||||
(identifier) @_cdef_identifier
|
||||
(_
|
||||
_
|
||||
(identifier) @_cdef_identifier)
|
||||
]
|
||||
arguments:
|
||||
(arguments
|
||||
(string
|
||||
content: _ @injection.content)))
|
||||
name: [
|
||||
(identifier) @_cdef_identifier
|
||||
(_
|
||||
_
|
||||
(identifier) @_cdef_identifier)
|
||||
]
|
||||
arguments: (arguments
|
||||
(string
|
||||
content: _ @injection.content)))
|
||||
(#set! injection.language "c")
|
||||
(#eq? @_cdef_identifier "cdef"))
|
||||
|
||||
((function_call
|
||||
name: (_) @_vimcmd_identifier
|
||||
arguments:
|
||||
(arguments
|
||||
(string
|
||||
content: _ @injection.content)))
|
||||
arguments: (arguments
|
||||
(string
|
||||
content: _ @injection.content)))
|
||||
(#set! injection.language "vim")
|
||||
(#any-of? @_vimcmd_identifier
|
||||
"vim.cmd" "vim.api.nvim_command" "vim.api.nvim_command" "vim.api.nvim_exec2"))
|
||||
|
||||
((function_call
|
||||
name: (_) @_vimcmd_identifier
|
||||
arguments:
|
||||
(arguments
|
||||
(string
|
||||
content: _ @injection.content) .))
|
||||
arguments: (arguments
|
||||
(string
|
||||
content: _ @injection.content) .))
|
||||
(#set! injection.language "query")
|
||||
(#any-of? @_vimcmd_identifier "vim.treesitter.query.set" "vim.treesitter.query.parse"))
|
||||
|
||||
((function_call
|
||||
name: (_) @_vimcmd_identifier
|
||||
arguments:
|
||||
(arguments
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(string
|
||||
content: _ @_method)
|
||||
.
|
||||
(string
|
||||
content: _ @injection.content)))
|
||||
arguments: (arguments
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(string
|
||||
content: _ @_method)
|
||||
.
|
||||
(string
|
||||
content: _ @injection.content)))
|
||||
(#any-of? @_vimcmd_identifier "vim.rpcrequest" "vim.rpcnotify")
|
||||
(#eq? @_method "nvim_exec_lua")
|
||||
(#set! injection.language "lua"))
|
||||
|
||||
; exec_lua [[ ... ]] in functionaltests
|
||||
((function_call
|
||||
name: (identifier) @_function
|
||||
arguments: (arguments
|
||||
(string
|
||||
content: (string_content) @injection.content)))
|
||||
(#eq? @_function "exec_lua")
|
||||
(#set! injection.language "lua"))
|
||||
|
||||
; vim.api.nvim_create_autocmd("FileType", { command = "injected here" })
|
||||
(function_call
|
||||
name: (_) @_vimcmd_identifier
|
||||
arguments:
|
||||
(arguments
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(table_constructor
|
||||
(field
|
||||
name: (identifier) @_command
|
||||
value:
|
||||
(string
|
||||
content: (_) @injection.content))) .)
|
||||
arguments: (arguments
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(table_constructor
|
||||
(field
|
||||
name: (identifier) @_command
|
||||
value: (string
|
||||
content: (_) @injection.content))) .)
|
||||
; limit so only 2-argument functions gets matched before pred handle
|
||||
(#eq? @_vimcmd_identifier "vim.api.nvim_create_autocmd")
|
||||
(#eq? @_command "command")
|
||||
@ -69,31 +71,29 @@
|
||||
|
||||
(function_call
|
||||
name: (_) @_user_cmd
|
||||
arguments:
|
||||
(arguments
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(string
|
||||
content: (_) @injection.content)
|
||||
.
|
||||
(_) .)
|
||||
arguments: (arguments
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(string
|
||||
content: (_) @injection.content)
|
||||
.
|
||||
(_) .)
|
||||
(#eq? @_user_cmd "vim.api.nvim_create_user_command")
|
||||
(#set! injection.language "vim"))
|
||||
|
||||
(function_call
|
||||
name: (_) @_user_cmd
|
||||
arguments:
|
||||
(arguments
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(string
|
||||
content: (_) @injection.content)
|
||||
.
|
||||
(_) .)
|
||||
arguments: (arguments
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(string
|
||||
content: (_) @injection.content)
|
||||
.
|
||||
(_) .)
|
||||
; Limiting predicate handling to only functions with 4 arguments
|
||||
(#eq? @_user_cmd "vim.api.nvim_buf_create_user_command")
|
||||
(#set! injection.language "vim"))
|
||||
|
@ -111,6 +111,12 @@
|
||||
((block_quote) @markup.quote
|
||||
(#set! "priority" 90))
|
||||
|
||||
([
|
||||
(plus_metadata)
|
||||
(minus_metadata)
|
||||
] @keyword.directive
|
||||
(#set! "priority" 90))
|
||||
|
||||
[
|
||||
(block_continuation)
|
||||
(block_quote_marker)
|
||||
|
@ -35,9 +35,8 @@
|
||||
|
||||
((assignment
|
||||
left: (identifier) @type.definition
|
||||
right:
|
||||
(call
|
||||
function: (identifier) @_func))
|
||||
right: (call
|
||||
function: (identifier) @_func))
|
||||
(#any-of? @_func "TypeVar" "NewType"))
|
||||
|
||||
; Function calls
|
||||
@ -45,18 +44,16 @@
|
||||
function: (identifier) @function.call)
|
||||
|
||||
(call
|
||||
function:
|
||||
(attribute
|
||||
attribute: (identifier) @function.method.call))
|
||||
function: (attribute
|
||||
attribute: (identifier) @function.method.call))
|
||||
|
||||
((call
|
||||
function: (identifier) @constructor)
|
||||
(#lua-match? @constructor "^%u"))
|
||||
|
||||
((call
|
||||
function:
|
||||
(attribute
|
||||
attribute: (identifier) @constructor))
|
||||
function: (attribute
|
||||
attribute: (identifier) @constructor))
|
||||
(#lua-match? @constructor "^%u"))
|
||||
|
||||
; Decorators
|
||||
@ -82,7 +79,7 @@
|
||||
|
||||
((decorator
|
||||
(identifier) @attribute.builtin)
|
||||
(#any-of? @attribute.builtin "classmethod" "property"))
|
||||
(#any-of? @attribute.builtin "classmethod" "property" "staticmethod"))
|
||||
|
||||
; Builtin functions
|
||||
((call
|
||||
@ -109,10 +106,9 @@
|
||||
|
||||
((call
|
||||
function: (identifier) @_isinstance
|
||||
arguments:
|
||||
(argument_list
|
||||
(_)
|
||||
(identifier) @type))
|
||||
arguments: (argument_list
|
||||
(_)
|
||||
(identifier) @type))
|
||||
(#eq? @_isinstance "isinstance"))
|
||||
|
||||
; Normal parameters
|
||||
@ -211,18 +207,16 @@
|
||||
(string) @string.documentation @spell))
|
||||
|
||||
(class_definition
|
||||
body:
|
||||
(block
|
||||
.
|
||||
(expression_statement
|
||||
(string) @string.documentation @spell)))
|
||||
body: (block
|
||||
.
|
||||
(expression_statement
|
||||
(string) @string.documentation @spell)))
|
||||
|
||||
(function_definition
|
||||
body:
|
||||
(block
|
||||
.
|
||||
(expression_statement
|
||||
(string) @string.documentation @spell)))
|
||||
body: (block
|
||||
.
|
||||
(expression_statement
|
||||
(string) @string.documentation @spell)))
|
||||
|
||||
; Tokens
|
||||
[
|
||||
@ -378,32 +372,27 @@
|
||||
name: (identifier) @type)
|
||||
|
||||
(class_definition
|
||||
body:
|
||||
(block
|
||||
(function_definition
|
||||
name: (identifier) @function.method)))
|
||||
body: (block
|
||||
(function_definition
|
||||
name: (identifier) @function.method)))
|
||||
|
||||
(class_definition
|
||||
superclasses:
|
||||
(argument_list
|
||||
(identifier) @type))
|
||||
superclasses: (argument_list
|
||||
(identifier) @type))
|
||||
|
||||
((class_definition
|
||||
body:
|
||||
(block
|
||||
(expression_statement
|
||||
(assignment
|
||||
left: (identifier) @variable.member))))
|
||||
body: (block
|
||||
(expression_statement
|
||||
(assignment
|
||||
left: (identifier) @variable.member))))
|
||||
(#lua-match? @variable.member "^[%l_].*$"))
|
||||
|
||||
((class_definition
|
||||
body:
|
||||
(block
|
||||
(expression_statement
|
||||
(assignment
|
||||
left:
|
||||
(_
|
||||
(identifier) @variable.member)))))
|
||||
body: (block
|
||||
(expression_statement
|
||||
(assignment
|
||||
left: (_
|
||||
(identifier) @variable.member)))))
|
||||
(#lua-match? @variable.member "^[%l_].*$"))
|
||||
|
||||
((class_definition
|
||||
@ -434,12 +423,10 @@
|
||||
|
||||
; Regex from the `re` module
|
||||
(call
|
||||
function:
|
||||
(attribute
|
||||
object: (identifier) @_re)
|
||||
arguments:
|
||||
(argument_list
|
||||
.
|
||||
(string
|
||||
(string_content) @string.regexp))
|
||||
function: (attribute
|
||||
object: (identifier) @_re)
|
||||
arguments: (argument_list
|
||||
.
|
||||
(string
|
||||
(string_content) @string.regexp))
|
||||
(#eq? @_re "re"))
|
||||
|
@ -68,20 +68,18 @@
|
||||
|
||||
((predicate
|
||||
name: (identifier) @_name
|
||||
parameters:
|
||||
(parameters
|
||||
(string
|
||||
"\"" @string
|
||||
"\"" @string) @string.regexp))
|
||||
parameters: (parameters
|
||||
(string
|
||||
"\"" @string
|
||||
"\"" @string) @string.regexp))
|
||||
(#any-of? @_name "match" "not-match" "vim-match" "not-vim-match" "lua-match" "not-lua-match"))
|
||||
|
||||
((predicate
|
||||
name: (identifier) @_name
|
||||
parameters:
|
||||
(parameters
|
||||
(string
|
||||
"\"" @string
|
||||
"\"" @string) @string.regexp
|
||||
.
|
||||
(string) .))
|
||||
parameters: (parameters
|
||||
(string
|
||||
"\"" @string
|
||||
"\"" @string) @string.regexp
|
||||
.
|
||||
(string) .))
|
||||
(#any-of? @_name "gsub" "not-gsub"))
|
||||
|
@ -42,9 +42,8 @@
|
||||
function: (identifier) @function.call)
|
||||
|
||||
(call_expression
|
||||
function:
|
||||
(scoped_identifier
|
||||
(identifier) @function.call))
|
||||
function: (scoped_identifier
|
||||
(identifier) @function.call))
|
||||
|
||||
(parameters
|
||||
(identifier) @variable.parameter)
|
||||
@ -206,10 +205,9 @@
|
||||
|
||||
(command_attribute
|
||||
name: _ @property
|
||||
val:
|
||||
(behavior
|
||||
name: _ @constant
|
||||
val: (identifier)? @function)?)
|
||||
val: (behavior
|
||||
name: _ @constant
|
||||
val: (identifier)? @function)?)
|
||||
|
||||
; Edit command
|
||||
(plus_plus_opt
|
||||
|
Loading…
Reference in New Issue
Block a user