aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2024-04-05 18:06:24 +0200
committerChristian Clason <c.clason@uni-graz.at>2024-04-05 18:36:17 +0200
commit39a0e6bf3c04f26cc2a43993fd63d94039b7262d (patch)
tree8f5585ef75963002572363f354d4c3768cc82072
parent73de98256cf3932dca156fbfd0c82c1cc10d487e (diff)
downloadrneovim-39a0e6bf3c04f26cc2a43993fd63d94039b7262d.tar.gz
rneovim-39a0e6bf3c04f26cc2a43993fd63d94039b7262d.tar.bz2
rneovim-39a0e6bf3c04f26cc2a43993fd63d94039b7262d.zip
fix(treesitter): update parsers and queries
-rw-r--r--cmake.deps/deps.txt4
-rw-r--r--runtime/queries/bash/highlights.scm20
-rw-r--r--runtime/queries/c/highlights.scm15
-rw-r--r--runtime/queries/lua/highlights.scm64
-rw-r--r--runtime/queries/lua/injections.scm120
-rw-r--r--runtime/queries/markdown/highlights.scm6
-rw-r--r--runtime/queries/python/highlights.scm89
-rw-r--r--runtime/queries/query/highlights.scm22
-rw-r--r--runtime/queries/vim/highlights.scm12
9 files changed, 167 insertions, 185 deletions
diff --git a/cmake.deps/deps.txt b/cmake.deps/deps.txt
index a6d44ca752..2504bed976 100644
--- a/cmake.deps/deps.txt
+++ b/cmake.deps/deps.txt
@@ -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
diff --git a/runtime/queries/bash/highlights.scm b/runtime/queries/bash/highlights.scm
index 86f9a67344..6547bea7ae 100644
--- a/runtime/queries/bash/highlights.scm
+++ b/runtime/queries/bash/highlights.scm
@@ -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
diff --git a/runtime/queries/c/highlights.scm b/runtime/queries/c/highlights.scm
index e22aac997f..c901b96f31 100644
--- a/runtime/queries/c/highlights.scm
+++ b/runtime/queries/c/highlights.scm
@@ -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)
diff --git a/runtime/queries/lua/highlights.scm b/runtime/queries/lua/highlights.scm
index 053d8116da..0c8f07f290 100644
--- a/runtime/queries/lua/highlights.scm
+++ b/runtime/queries/lua/highlights.scm
@@ -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)))
diff --git a/runtime/queries/lua/injections.scm b/runtime/queries/lua/injections.scm
index a76f764d76..4345c71ce8 100644
--- a/runtime/queries/lua/injections.scm
+++ b/runtime/queries/lua/injections.scm
@@ -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"))
diff --git a/runtime/queries/markdown/highlights.scm b/runtime/queries/markdown/highlights.scm
index ac582e3f9b..4b445e02f3 100644
--- a/runtime/queries/markdown/highlights.scm
+++ b/runtime/queries/markdown/highlights.scm
@@ -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)
diff --git a/runtime/queries/python/highlights.scm b/runtime/queries/python/highlights.scm
index fea97bed32..4d62aeff06 100644
--- a/runtime/queries/python/highlights.scm
+++ b/runtime/queries/python/highlights.scm
@@ -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"))
diff --git a/runtime/queries/query/highlights.scm b/runtime/queries/query/highlights.scm
index cdedb23e29..abc7aa50ad 100644
--- a/runtime/queries/query/highlights.scm
+++ b/runtime/queries/query/highlights.scm
@@ -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"))
diff --git a/runtime/queries/vim/highlights.scm b/runtime/queries/vim/highlights.scm
index cc51282a71..2950278f9f 100644
--- a/runtime/queries/vim/highlights.scm
+++ b/runtime/queries/vim/highlights.scm
@@ -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