aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/treesitter.lua
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/lua/vim/treesitter.lua')
-rw-r--r--runtime/lua/vim/treesitter.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/runtime/lua/vim/treesitter.lua b/runtime/lua/vim/treesitter.lua
index cc8be72670..0e34cbcbcc 100644
--- a/runtime/lua/vim/treesitter.lua
+++ b/runtime/lua/vim/treesitter.lua
@@ -127,6 +127,7 @@ function M.get_parser(bufnr, lang, opts)
)
end
elseif parsers[bufnr] == nil or parsers[bufnr]:lang() ~= lang then
+ assert(lang, 'lang should be valid')
parsers[bufnr] = M._create_parser(bufnr, lang, opts)
end
@@ -162,7 +163,7 @@ function M.is_ancestor(dest, source)
return false
end
- local current = source
+ local current = source ---@type TSNode?
while current ~= nil do
if current == dest then
return true
@@ -491,7 +492,7 @@ end
--- function, it accepts the buffer number of the source buffer as its only
--- argument and should return a string.
function M.inspect_tree(opts)
- ---@cast opts InspectTreeOpts
+ ---@diagnostic disable-next-line: invisible
require('vim.treesitter.dev').inspect_tree(opts)
end