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_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

View File

@ -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,8 +175,7 @@
"trap" "type" "typeset" "ulimit" "umask" "unalias" "wait"))
(command
argument:
[
argument: [
(word) @variable.parameter
(concatenation
(word) @variable.parameter)

View File

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

View File

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

View File

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

View File

@ -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)

View File

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

View File

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

View File

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