fix: resolve all remaining LuaLS diagnostics

This commit is contained in:
Lewis Russell
2025-01-24 13:01:25 +00:00
committed by Lewis Russell
parent 83479b95ab
commit 6aa42e8f92
41 changed files with 177 additions and 104 deletions

View File

@@ -149,7 +149,7 @@ end
--- Returns the node's range or an unpacked range table
---
---@param node_or_range (TSNode | table) Node or table of positions
---@param node_or_range TSNode|Range4 Node or table of positions
---
---@return integer start_row
---@return integer start_col
@@ -157,7 +157,8 @@ end
---@return integer end_col
function M.get_node_range(node_or_range)
if type(node_or_range) == 'table' then
return unpack(node_or_range)
--- @cast node_or_range -TSNode LuaLS bug
return M._range.unpack4(node_or_range)
else
return node_or_range:range(false)
end
@@ -238,7 +239,9 @@ function M.node_contains(node, range)
-- allow a table so nodes can be mocked
vim.validate('node', node, { 'userdata', 'table' })
vim.validate('range', range, M._range.validate, 'integer list with 4 or 6 elements')
return M._range.contains({ node:range() }, range)
--- @diagnostic disable-next-line: missing-fields LuaLS bug
local nrange = { node:range() } --- @type Range4
return M._range.contains(nrange, range)
end
--- Returns a list of highlight captures at the given position