mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
feat!(treesitter): do not return changes from LanguageTree:parse()
Never return the changes an only notify them using the `on_changedtree` callback. It is not guaranteed for a plugin that it'll be the first one to call `tree:parse()` and thus get the changes. Closes #19915
This commit is contained in:
parent
845efb8e12
commit
762a06c6bc
@ -232,7 +232,10 @@ The following deprecated functions or APIs were removed.
|
|||||||
changes need to be contributed there first.)
|
changes need to be contributed there first.)
|
||||||
See https://github.com/neovim/neovim/pull/20674.
|
See https://github.com/neovim/neovim/pull/20674.
|
||||||
|
|
||||||
- 'hkmap', 'hkmapp' and 'aleph' options were removed. Use 'keymap' option instead.
|
• 'hkmap', 'hkmapp' and 'aleph' options were removed. Use 'keymap' option instead.
|
||||||
|
|
||||||
|
• |LanguageTree:parse()| no longer returns changed regions. Please use the
|
||||||
|
`on_changedtree` callbacks instead.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
DEPRECATIONS *news-deprecations*
|
DEPRECATIONS *news-deprecations*
|
||||||
|
@ -1099,7 +1099,6 @@ LanguageTree:parse({self}) *LanguageTree:parse()*
|
|||||||
|
|
||||||
Return: ~
|
Return: ~
|
||||||
TSTree[]
|
TSTree[]
|
||||||
(table|nil) Change list
|
|
||||||
|
|
||||||
LanguageTree:register_cbs({self}, {cbs}) *LanguageTree:register_cbs()*
|
LanguageTree:register_cbs({self}, {cbs}) *LanguageTree:register_cbs()*
|
||||||
Registers callbacks for the |LanguageTree|.
|
Registers callbacks for the |LanguageTree|.
|
||||||
|
@ -228,7 +228,6 @@ end
|
|||||||
--- determine if any child languages should be created.
|
--- determine if any child languages should be created.
|
||||||
---
|
---
|
||||||
---@return TSTree[]
|
---@return TSTree[]
|
||||||
---@return table|nil Change list
|
|
||||||
function LanguageTree:parse()
|
function LanguageTree:parse()
|
||||||
if self:is_valid() then
|
if self:is_valid() then
|
||||||
self:_log('valid')
|
self:_log('valid')
|
||||||
@ -302,18 +301,12 @@ function LanguageTree:parse()
|
|||||||
})
|
})
|
||||||
|
|
||||||
self:for_each_child(function(child)
|
self:for_each_child(function(child)
|
||||||
local _, child_changes = child:parse()
|
child:parse()
|
||||||
|
|
||||||
-- Propagate any child changes so they are included in the
|
|
||||||
-- the change list for the callback.
|
|
||||||
if child_changes then
|
|
||||||
vim.list_extend(changes, child_changes)
|
|
||||||
end
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
self._valid = true
|
self._valid = true
|
||||||
|
|
||||||
return self._trees, changes
|
return self._trees
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Invokes the callback for each |LanguageTree| and its children recursively
|
--- Invokes the callback for each |LanguageTree| and its children recursively
|
||||||
|
Loading…
Reference in New Issue
Block a user