diff options
author | Jaehwang Jung <tomtomjhj@gmail.com> | 2023-09-17 17:54:30 +0900 |
---|---|---|
committer | Lewis Russell <me@lewisr.dev> | 2023-09-17 19:52:35 +0100 |
commit | 71d9b7d15c9b2e0df7db69a172aea0723a40bb71 (patch) | |
tree | aaa72491c8ed1dedcca7b72375173b84d0e8d570 /runtime/lua/vim/treesitter/_meta.lua | |
parent | f54677132b9052640ec0ecb79001a69a6d032565 (diff) | |
download | rneovim-71d9b7d15c9b2e0df7db69a172aea0723a40bb71.tar.gz rneovim-71d9b7d15c9b2e0df7db69a172aea0723a40bb71.tar.bz2 rneovim-71d9b7d15c9b2e0df7db69a172aea0723a40bb71.zip |
fix(treesitter): _trees may not be list-like
Problem:
With incremental injection parsing, injected languages' parsers parse
only the relevant regions and stores the result in _trees with the index
of the corresponding region. Therefore, there can be holes in _trees.
Solution:
* Use generic table functions where appropriate.
* Fix type annotations and docs.
Diffstat (limited to 'runtime/lua/vim/treesitter/_meta.lua')
-rw-r--r-- | runtime/lua/vim/treesitter/_meta.lua | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/runtime/lua/vim/treesitter/_meta.lua b/runtime/lua/vim/treesitter/_meta.lua index 9a94f12c16..d01b7be3b0 100644 --- a/runtime/lua/vim/treesitter/_meta.lua +++ b/runtime/lua/vim/treesitter/_meta.lua @@ -50,7 +50,8 @@ function TSNode:_rawquery(query, captures, start, end_, opts) end ---@alias TSLoggerCallback fun(logtype: 'parse'|'lex', msg: string) ---@class TSParser ----@field parse fun(self: TSParser, tree: TSTree?, source: integer|string, include_bytes: boolean?): TSTree, integer[] +---@field parse fun(self: TSParser, tree: TSTree?, source: integer|string, include_bytes: true): TSTree, Range6[] +---@field parse fun(self: TSParser, tree: TSTree?, source: integer|string, include_bytes: false|nil): TSTree, Range4[] ---@field reset fun(self: TSParser) ---@field included_ranges fun(self: TSParser, include_bytes: boolean?): integer[] ---@field set_included_ranges fun(self: TSParser, ranges: (Range6|TSNode)[]) |