mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 11:28:22 +00:00
fix(treesitter): update lua parser and queries (#24148)
This commit is contained in:
@@ -46,8 +46,8 @@ LIBICONV_SHA256 ccf536620a45458d26ba83887a983b96827001e92a13847b45e4925cc8913178
|
|||||||
|
|
||||||
TREESITTER_C_URL https://github.com/tree-sitter/tree-sitter-c/archive/v0.20.2.tar.gz
|
TREESITTER_C_URL https://github.com/tree-sitter/tree-sitter-c/archive/v0.20.2.tar.gz
|
||||||
TREESITTER_C_SHA256 af66fde03feb0df4faf03750102a0d265b007e5d957057b6b293c13116a70af2
|
TREESITTER_C_SHA256 af66fde03feb0df4faf03750102a0d265b007e5d957057b6b293c13116a70af2
|
||||||
TREESITTER_LUA_URL https://github.com/MunifTanjim/tree-sitter-lua/archive/v0.0.17.tar.gz
|
TREESITTER_LUA_URL https://github.com/MunifTanjim/tree-sitter-lua/archive/v0.0.18.tar.gz
|
||||||
TREESITTER_LUA_SHA256 8963fd0a185d786c164dfca3824941c7eaec497ce49a3a0bc24bf753f5e0e59c
|
TREESITTER_LUA_SHA256 659beef871a7fa1d9a02c23f5ebf55019aa3adce6d7f5441947781e128845256
|
||||||
TREESITTER_VIM_URL https://github.com/neovim/tree-sitter-vim/archive/v0.3.0.tar.gz
|
TREESITTER_VIM_URL https://github.com/neovim/tree-sitter-vim/archive/v0.3.0.tar.gz
|
||||||
TREESITTER_VIM_SHA256 403acec3efb7cdb18ff3d68640fc823502a4ffcdfbb71cec3f98aa786c21cbe2
|
TREESITTER_VIM_SHA256 403acec3efb7cdb18ff3d68640fc823502a4ffcdfbb71cec3f98aa786c21cbe2
|
||||||
TREESITTER_VIMDOC_URL https://github.com/neovim/tree-sitter-vimdoc/archive/v2.0.0.tar.gz
|
TREESITTER_VIMDOC_URL https://github.com/neovim/tree-sitter-vimdoc/archive/v2.0.0.tar.gz
|
||||||
|
@@ -180,13 +180,40 @@
|
|||||||
|
|
||||||
(parameters (identifier) @parameter)
|
(parameters (identifier) @parameter)
|
||||||
|
|
||||||
(function_call name: (identifier) @function.call)
|
(function_declaration
|
||||||
(function_declaration name: (identifier) @function)
|
name: [
|
||||||
|
(identifier) @function
|
||||||
|
(dot_index_expression
|
||||||
|
field: (identifier) @function)
|
||||||
|
])
|
||||||
|
|
||||||
(function_call name: (dot_index_expression field: (identifier) @function.call))
|
(function_declaration
|
||||||
(function_declaration name: (dot_index_expression field: (identifier) @function))
|
name: (method_index_expression
|
||||||
|
method: (identifier) @method))
|
||||||
|
|
||||||
(method_index_expression method: (identifier) @method.call)
|
(assignment_statement
|
||||||
|
(variable_list .
|
||||||
|
name: [
|
||||||
|
(identifier) @function
|
||||||
|
(dot_index_expression
|
||||||
|
field: (identifier) @function)
|
||||||
|
])
|
||||||
|
(expression_list .
|
||||||
|
value: (function_definition)))
|
||||||
|
|
||||||
|
(table_constructor
|
||||||
|
(field
|
||||||
|
name: (identifier) @function
|
||||||
|
value: (function_definition)))
|
||||||
|
|
||||||
|
(function_call
|
||||||
|
name: [
|
||||||
|
(identifier) @function.call
|
||||||
|
(dot_index_expression
|
||||||
|
field: (identifier) @function.call)
|
||||||
|
(method_index_expression
|
||||||
|
method: (identifier) @method.call)
|
||||||
|
])
|
||||||
|
|
||||||
(function_call
|
(function_call
|
||||||
(identifier) @function.builtin
|
(identifier) @function.builtin
|
||||||
|
@@ -3,7 +3,9 @@
|
|||||||
(identifier) @_cdef_identifier
|
(identifier) @_cdef_identifier
|
||||||
(_ _ (identifier) @_cdef_identifier)
|
(_ _ (identifier) @_cdef_identifier)
|
||||||
]
|
]
|
||||||
arguments: (arguments (string content: _ @injection.content)))
|
arguments:
|
||||||
|
(arguments
|
||||||
|
(string content: _ @injection.content)))
|
||||||
(#set! injection.language "c")
|
(#set! injection.language "c")
|
||||||
(#eq? @_cdef_identifier "cdef"))
|
(#eq? @_cdef_identifier "cdef"))
|
||||||
|
|
||||||
@@ -11,15 +13,7 @@
|
|||||||
name: (_) @_vimcmd_identifier
|
name: (_) @_vimcmd_identifier
|
||||||
arguments: (arguments (string content: _ @injection.content)))
|
arguments: (arguments (string content: _ @injection.content)))
|
||||||
(#set! injection.language "vim")
|
(#set! injection.language "vim")
|
||||||
(#any-of? @_vimcmd_identifier "vim.cmd" "vim.api.nvim_command" "vim.api.nvim_exec2" "vim.api.nvim_cmd"))
|
(#any-of? @_vimcmd_identifier "vim.cmd" "vim.api.nvim_command" "vim.api.nvim_command" "vim.api.nvim_exec2"))
|
||||||
|
|
||||||
; vim.rcprequest(123, "nvim_exec_lua", "return vim.api.nvim_buf_get_lines(0, 0, -1, false)", false)
|
|
||||||
((function_call
|
|
||||||
name: (_) @_vimcmd_identifier
|
|
||||||
arguments: (arguments . (_) . (string content: _ @_method) . (string content: _ @injection.content)))
|
|
||||||
(#set! injection.language "lua")
|
|
||||||
(#any-of? @_vimcmd_identifier "vim.rpcrequest" "vim.rpcnotify")
|
|
||||||
(#eq? @_method "nvim_exec_lua"))
|
|
||||||
|
|
||||||
((function_call
|
((function_call
|
||||||
name: (_) @_vimcmd_identifier
|
name: (_) @_vimcmd_identifier
|
||||||
@@ -27,10 +21,15 @@
|
|||||||
(#set! injection.language "query")
|
(#set! injection.language "query")
|
||||||
(#any-of? @_vimcmd_identifier "vim.treesitter.query.set" "vim.treesitter.query.parse"))
|
(#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)))
|
||||||
|
(#any-of? @_vimcmd_identifier "vim.rpcrequest" "vim.rpcnotify")
|
||||||
|
(#eq? @_method "nvim_exec_lua")
|
||||||
|
(#set! injection.language "lua"))
|
||||||
|
|
||||||
;; highlight string as query if starts with `;; query`
|
;; highlight string as query if starts with `;; query`
|
||||||
(string content: _ @injection.content
|
(string content: _ @injection.content
|
||||||
(#set! injection.language "query")
|
(#lua-match? @injection.content "^%s*;+%s?query")
|
||||||
(#lua-match? @injection.content "^%s*;+%s?query"))
|
(#set! injection.language "query"))
|
||||||
|
|
||||||
; ((comment) @injection.content
|
|
||||||
; (#set! injection.language "comment"))
|
|
||||||
|
Reference in New Issue
Block a user