aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/treesitter/dev.lua
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2025-06-05 11:31:51 +0100
committerLewis Russell <me@lewisr.dev>2025-06-06 15:36:48 +0100
commit3b6084ddf4f0d49fb0e5d135919c9daacea2a46d (patch)
treec46454da48ec05e345c953f4e172e52dff8bef52 /runtime/lua/vim/treesitter/dev.lua
parent4c333fdbb7bee299f36624b429f5c065470e421d (diff)
downloadrneovim-3b6084ddf4f0d49fb0e5d135919c9daacea2a46d.tar.gz
rneovim-3b6084ddf4f0d49fb0e5d135919c9daacea2a46d.tar.bz2
rneovim-3b6084ddf4f0d49fb0e5d135919c9daacea2a46d.zip
fix: type fixes
Type fixes caught by emmylua
Diffstat (limited to 'runtime/lua/vim/treesitter/dev.lua')
-rw-r--r--runtime/lua/vim/treesitter/dev.lua13
1 files changed, 6 insertions, 7 deletions
diff --git a/runtime/lua/vim/treesitter/dev.lua b/runtime/lua/vim/treesitter/dev.lua
index 1ce1916d4b..f44db7b668 100644
--- a/runtime/lua/vim/treesitter/dev.lua
+++ b/runtime/lua/vim/treesitter/dev.lua
@@ -15,7 +15,7 @@ local TSTreeView = {}
---@class (private) vim.treesitter.dev.TSTreeViewOpts
---@field anon boolean If true, display anonymous nodes.
---@field lang boolean If true, display the language alongside each node.
----@field indent number Number of spaces to indent nested lines.
+---@field indent integer Number of spaces to indent nested lines.
---@class (private) vim.treesitter.dev.Node
---@field node TSNode Treesitter node
@@ -290,7 +290,7 @@ end
--- The node number is dependent on whether or not anonymous nodes are displayed.
---
---@param i integer Node number to get
----@return vim.treesitter.dev.Node
+---@return vim.treesitter.dev.Node?
---@package
function TSTreeView:get(i)
local t = self.opts.anon and self.nodes or self.named
@@ -329,8 +329,7 @@ end
--- source buffer as its only argument and should return a string.
--- @field title (string|fun(bufnr:integer):string|nil)
---- @private
----
+--- @nodoc
--- @param opts vim.treesitter.dev.inspect_tree.Opts?
function M.inspect_tree(opts)
vim.validate('opts', opts, 'table', true)
@@ -401,7 +400,7 @@ function M.inspect_tree(opts)
-- update source window if original was closed
if not api.nvim_win_is_valid(win) then
- win = vim.fn.win_findbuf(buf)[1]
+ win = assert(vim.fn.win_findbuf(buf)[1])
end
api.nvim_set_current_win(win)
@@ -475,7 +474,7 @@ function M.inspect_tree(opts)
-- update source window if original was closed
if not api.nvim_win_is_valid(win) then
- win = vim.fn.win_findbuf(buf)[1]
+ win = assert(vim.fn.win_findbuf(buf)[1])
end
local topline, botline = vim.fn.line('w0', win), vim.fn.line('w$', win)
@@ -599,7 +598,7 @@ local function update_editor_highlights(query_win, base_win, lang)
end
end
---- @private
+--- @nodoc
--- @param lang? string language to open the query editor for.
--- @return boolean? `true` on success, `nil` on failure
--- @return string? error message, if applicable