mirror of
https://github.com/neovim/neovim.git
synced 2025-12-15 19:05:40 +00:00
refactor(treesitter): deprecate for_each_child #25118
The name for_each_child is misleading and caused bugs. After #25111, #25115, there are no more usages of `for_each_child` in Nvim. In the future if we want to restore this functionality we can consider a generalized vim.traverse(node, key, visitor) function.
This commit is contained in:
@@ -451,11 +451,14 @@ function LanguageTree:parse(range)
|
||||
return self._trees
|
||||
end
|
||||
|
||||
---@deprecated Misleading name. Use `LanguageTree:children()` (non-recursive) instead,
|
||||
--- add recursion yourself if needed.
|
||||
--- Invokes the callback for each |LanguageTree| and its children recursively
|
||||
---
|
||||
---@param fn fun(tree: LanguageTree, lang: string)
|
||||
---@param include_self boolean|nil Whether to include the invoking tree in the results
|
||||
function LanguageTree:for_each_child(fn, include_self)
|
||||
vim.deprecate('LanguageTree:for_each_child()', 'LanguageTree:children()', '0.11')
|
||||
if include_self then
|
||||
fn(self, self._lang)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user