mirror of
https://github.com/neovim/neovim.git
synced 2026-04-21 14:55:33 +00:00
feat(treesitter): clarify similar 'get_node_range' functions
The private 'get_node_range' function from the languagetree module has been renamed and remains private as it serve a purpose that is only relevant inside the languagetree module. The 'get_node_range' upstreamed from nvim-treesitter in the treesitter module has been made public as it is in itself a utlity function.
This commit is contained in:
@@ -141,6 +141,19 @@ function M.is_ancestor(dest, source)
|
||||
return false
|
||||
end
|
||||
|
||||
--- Get the node's range or unpack a range table
|
||||
---
|
||||
---@param node_or_range table
|
||||
---
|
||||
---@returns start_row, start_col, end_row, end_col
|
||||
function M.get_node_range(node_or_range)
|
||||
if type(node_or_range) == 'table' then
|
||||
return unpack(node_or_range)
|
||||
else
|
||||
return node_or_range:range()
|
||||
end
|
||||
end
|
||||
|
||||
---Determines if a node contains a range
|
||||
---@param node table The node
|
||||
---@param range table The range
|
||||
|
||||
Reference in New Issue
Block a user