fix(treesitter): update parsers and queries

This commit is contained in:
Christian Clason 2024-04-05 18:06:24 +02:00
parent 73de98256c
commit 39a0e6bf3c
9 changed files with 167 additions and 185 deletions

View File

@ -55,7 +55,7 @@ TREESITTER_PYTHON_URL https://github.com/tree-sitter/tree-sitter-python/archive/
TREESITTER_PYTHON_SHA256 720304a603271fa89e4430a14d6a81a023d6d7d1171b1533e49c0ab44f1e1c13 TREESITTER_PYTHON_SHA256 720304a603271fa89e4430a14d6a81a023d6d7d1171b1533e49c0ab44f1e1c13
TREESITTER_BASH_URL https://github.com/tree-sitter/tree-sitter-bash/archive/v0.21.0.tar.gz TREESITTER_BASH_URL https://github.com/tree-sitter/tree-sitter-bash/archive/v0.21.0.tar.gz
TREESITTER_BASH_SHA256 f0515efda839cfede851adb24ac154227fbc0dfb60c6c11595ecfa9087d43ceb TREESITTER_BASH_SHA256 f0515efda839cfede851adb24ac154227fbc0dfb60c6c11595ecfa9087d43ceb
TREESITTER_MARKDOWN_URL https://github.com/MDeiml/tree-sitter-markdown/archive/v0.2.1.tar.gz TREESITTER_MARKDOWN_URL https://github.com/MDeiml/tree-sitter-markdown/archive/v0.2.3.tar.gz
TREESITTER_MARKDOWN_SHA256 d5dee1f57807a633062d03e19ad59d9b5e28f882da1ebe69a2e31f1df5b308ca TREESITTER_MARKDOWN_SHA256 4909d6023643f1afc3ab219585d4035b7403f3a17849782ab803c5f73c8a31d5
TREESITTER_URL https://github.com/tree-sitter/tree-sitter/archive/v0.22.2.tar.gz TREESITTER_URL https://github.com/tree-sitter/tree-sitter/archive/v0.22.2.tar.gz
TREESITTER_SHA256 0c829523b876d4a37e1bd46a655c133a93669c0fe98fcd84972b168849c27afc TREESITTER_SHA256 0c829523b876d4a37e1bd46a655c133a93669c0fe98fcd84972b168849c27afc

View File

@ -124,10 +124,15 @@
(test_operator) @operator (test_operator) @operator
(command_substitution (command_substitution
"$(" @punctuation.bracket) "$(" @punctuation.special
")" @punctuation.special)
(process_substitution (process_substitution
"<(" @punctuation.bracket) [
"<("
">("
] @punctuation.special
")" @punctuation.special)
(arithmetic_expansion (arithmetic_expansion
[ [
@ -170,8 +175,7 @@
"trap" "type" "typeset" "ulimit" "umask" "unalias" "wait")) "trap" "type" "typeset" "ulimit" "umask" "unalias" "wait"))
(command (command
argument: argument: [
[
(word) @variable.parameter (word) @variable.parameter
(concatenation (concatenation
(word) @variable.parameter) (word) @variable.parameter)

View File

@ -142,9 +142,6 @@
(char_literal) @character (char_literal) @character
((preproc_arg) @function.macro
(#set! "priority" 90))
(preproc_defined) @function.macro (preproc_defined) @function.macro
((field_expression ((field_expression
@ -263,16 +260,14 @@
function: (identifier) @function.call) function: (identifier) @function.call)
(call_expression (call_expression
function: function: (field_expression
(field_expression
field: (field_identifier) @function.call)) field: (field_identifier) @function.call))
(function_declarator (function_declarator
declarator: (identifier) @function) declarator: (identifier) @function)
(function_declarator (function_declarator
declarator: declarator: (parenthesized_declarator
(parenthesized_declarator
(pointer_declarator (pointer_declarator
declarator: (field_identifier) @function))) declarator: (field_identifier) @function)))

View File

@ -180,23 +180,20 @@
(vararg_expression) @variable.parameter.builtin (vararg_expression) @variable.parameter.builtin
(function_declaration (function_declaration
name: name: [
[
(identifier) @function (identifier) @function
(dot_index_expression (dot_index_expression
field: (identifier) @function) field: (identifier) @function)
]) ])
(function_declaration (function_declaration
name: name: (method_index_expression
(method_index_expression
method: (identifier) @function.method)) method: (identifier) @function.method))
(assignment_statement (assignment_statement
(variable_list (variable_list
. .
name: name: [
[
(identifier) @function (identifier) @function
(dot_index_expression (dot_index_expression
field: (identifier) @function) field: (identifier) @function)
@ -211,8 +208,7 @@
value: (function_definition))) value: (function_definition)))
(function_call (function_call
name: name: [
[
(identifier) @function.call (identifier) @function.call
(dot_index_expression (dot_index_expression
field: (identifier) @function.call) field: (identifier) @function.call)
@ -253,8 +249,7 @@
(dot_index_expression (dot_index_expression
field: (identifier) @_method field: (identifier) @_method
(#any-of? @_method "find" "match" "gmatch" "gsub")) (#any-of? @_method "find" "match" "gmatch" "gsub"))
arguments: arguments: (arguments
(arguments
. .
(_) (_)
. .
@ -266,8 +261,7 @@
(method_index_expression (method_index_expression
method: (identifier) @_method method: (identifier) @_method
(#any-of? @_method "find" "match" "gmatch" "gsub")) (#any-of? @_method "find" "match" "gmatch" "gsub"))
arguments: arguments: (arguments
(arguments
. .
(string (string
content: (string_content) @string.regexp))) content: (string_content) @string.regexp)))

View File

@ -1,13 +1,11 @@
((function_call ((function_call
name: name: [
[
(identifier) @_cdef_identifier (identifier) @_cdef_identifier
(_ (_
_ _
(identifier) @_cdef_identifier) (identifier) @_cdef_identifier)
] ]
arguments: arguments: (arguments
(arguments
(string (string
content: _ @injection.content))) content: _ @injection.content)))
(#set! injection.language "c") (#set! injection.language "c")
@ -15,8 +13,7 @@
((function_call ((function_call
name: (_) @_vimcmd_identifier name: (_) @_vimcmd_identifier
arguments: arguments: (arguments
(arguments
(string (string
content: _ @injection.content))) content: _ @injection.content)))
(#set! injection.language "vim") (#set! injection.language "vim")
@ -25,8 +22,7 @@
((function_call ((function_call
name: (_) @_vimcmd_identifier name: (_) @_vimcmd_identifier
arguments: arguments: (arguments
(arguments
(string (string
content: _ @injection.content) .)) content: _ @injection.content) .))
(#set! injection.language "query") (#set! injection.language "query")
@ -34,8 +30,7 @@
((function_call ((function_call
name: (_) @_vimcmd_identifier name: (_) @_vimcmd_identifier
arguments: arguments: (arguments
(arguments
. .
(_) (_)
. .
@ -48,19 +43,26 @@
(#eq? @_method "nvim_exec_lua") (#eq? @_method "nvim_exec_lua")
(#set! injection.language "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" }) ; vim.api.nvim_create_autocmd("FileType", { command = "injected here" })
(function_call (function_call
name: (_) @_vimcmd_identifier name: (_) @_vimcmd_identifier
arguments: arguments: (arguments
(arguments
. .
(_) (_)
. .
(table_constructor (table_constructor
(field (field
name: (identifier) @_command name: (identifier) @_command
value: value: (string
(string
content: (_) @injection.content))) .) content: (_) @injection.content))) .)
; limit so only 2-argument functions gets matched before pred handle ; limit so only 2-argument functions gets matched before pred handle
(#eq? @_vimcmd_identifier "vim.api.nvim_create_autocmd") (#eq? @_vimcmd_identifier "vim.api.nvim_create_autocmd")
@ -69,8 +71,7 @@
(function_call (function_call
name: (_) @_user_cmd name: (_) @_user_cmd
arguments: arguments: (arguments
(arguments
. .
(_) (_)
. .
@ -83,8 +84,7 @@
(function_call (function_call
name: (_) @_user_cmd name: (_) @_user_cmd
arguments: arguments: (arguments
(arguments
. .
(_) (_)
. .

View File

@ -111,6 +111,12 @@
((block_quote) @markup.quote ((block_quote) @markup.quote
(#set! "priority" 90)) (#set! "priority" 90))
([
(plus_metadata)
(minus_metadata)
] @keyword.directive
(#set! "priority" 90))
[ [
(block_continuation) (block_continuation)
(block_quote_marker) (block_quote_marker)

View File

@ -35,8 +35,7 @@
((assignment ((assignment
left: (identifier) @type.definition left: (identifier) @type.definition
right: right: (call
(call
function: (identifier) @_func)) function: (identifier) @_func))
(#any-of? @_func "TypeVar" "NewType")) (#any-of? @_func "TypeVar" "NewType"))
@ -45,8 +44,7 @@
function: (identifier) @function.call) function: (identifier) @function.call)
(call (call
function: function: (attribute
(attribute
attribute: (identifier) @function.method.call)) attribute: (identifier) @function.method.call))
((call ((call
@ -54,8 +52,7 @@
(#lua-match? @constructor "^%u")) (#lua-match? @constructor "^%u"))
((call ((call
function: function: (attribute
(attribute
attribute: (identifier) @constructor)) attribute: (identifier) @constructor))
(#lua-match? @constructor "^%u")) (#lua-match? @constructor "^%u"))
@ -82,7 +79,7 @@
((decorator ((decorator
(identifier) @attribute.builtin) (identifier) @attribute.builtin)
(#any-of? @attribute.builtin "classmethod" "property")) (#any-of? @attribute.builtin "classmethod" "property" "staticmethod"))
; Builtin functions ; Builtin functions
((call ((call
@ -109,8 +106,7 @@
((call ((call
function: (identifier) @_isinstance function: (identifier) @_isinstance
arguments: arguments: (argument_list
(argument_list
(_) (_)
(identifier) @type)) (identifier) @type))
(#eq? @_isinstance "isinstance")) (#eq? @_isinstance "isinstance"))
@ -211,15 +207,13 @@
(string) @string.documentation @spell)) (string) @string.documentation @spell))
(class_definition (class_definition
body: body: (block
(block
. .
(expression_statement (expression_statement
(string) @string.documentation @spell))) (string) @string.documentation @spell)))
(function_definition (function_definition
body: body: (block
(block
. .
(expression_statement (expression_statement
(string) @string.documentation @spell))) (string) @string.documentation @spell)))
@ -378,31 +372,26 @@
name: (identifier) @type) name: (identifier) @type)
(class_definition (class_definition
body: body: (block
(block
(function_definition (function_definition
name: (identifier) @function.method))) name: (identifier) @function.method)))
(class_definition (class_definition
superclasses: superclasses: (argument_list
(argument_list
(identifier) @type)) (identifier) @type))
((class_definition ((class_definition
body: body: (block
(block
(expression_statement (expression_statement
(assignment (assignment
left: (identifier) @variable.member)))) left: (identifier) @variable.member))))
(#lua-match? @variable.member "^[%l_].*$")) (#lua-match? @variable.member "^[%l_].*$"))
((class_definition ((class_definition
body: body: (block
(block
(expression_statement (expression_statement
(assignment (assignment
left: left: (_
(_
(identifier) @variable.member))))) (identifier) @variable.member)))))
(#lua-match? @variable.member "^[%l_].*$")) (#lua-match? @variable.member "^[%l_].*$"))
@ -434,11 +423,9 @@
; Regex from the `re` module ; Regex from the `re` module
(call (call
function: function: (attribute
(attribute
object: (identifier) @_re) object: (identifier) @_re)
arguments: arguments: (argument_list
(argument_list
. .
(string (string
(string_content) @string.regexp)) (string_content) @string.regexp))

View File

@ -68,8 +68,7 @@
((predicate ((predicate
name: (identifier) @_name name: (identifier) @_name
parameters: parameters: (parameters
(parameters
(string (string
"\"" @string "\"" @string
"\"" @string) @string.regexp)) "\"" @string) @string.regexp))
@ -77,8 +76,7 @@
((predicate ((predicate
name: (identifier) @_name name: (identifier) @_name
parameters: parameters: (parameters
(parameters
(string (string
"\"" @string "\"" @string
"\"" @string) @string.regexp "\"" @string) @string.regexp

View File

@ -42,8 +42,7 @@
function: (identifier) @function.call) function: (identifier) @function.call)
(call_expression (call_expression
function: function: (scoped_identifier
(scoped_identifier
(identifier) @function.call)) (identifier) @function.call))
(parameters (parameters
@ -206,8 +205,7 @@
(command_attribute (command_attribute
name: _ @property name: _ @property
val: val: (behavior
(behavior
name: _ @constant name: _ @constant
val: (identifier)? @function)?) val: (identifier)? @function)?)