aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2023-03-10 16:16:49 +0000
committerGitHub <noreply@github.com>2023-03-10 16:16:49 +0000
commit762a06c6bcfbcc1e40ba670bae10bacdbb973524 (patch)
tree35220bdc0bcd8b3a2562a7d553c64b619d1b8a72 /runtime/lua/vim
parent845efb8e12cb014b385deac62fb83622a99024ec (diff)
downloadrneovim-762a06c6bcfbcc1e40ba670bae10bacdbb973524.tar.gz
rneovim-762a06c6bcfbcc1e40ba670bae10bacdbb973524.tar.bz2
rneovim-762a06c6bcfbcc1e40ba670bae10bacdbb973524.zip
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
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r--runtime/lua/vim/treesitter/languagetree.lua11
1 files changed, 2 insertions, 9 deletions
diff --git a/runtime/lua/vim/treesitter/languagetree.lua b/runtime/lua/vim/treesitter/languagetree.lua
index c89419085f..26321cd1f4 100644
--- a/runtime/lua/vim/treesitter/languagetree.lua
+++ b/runtime/lua/vim/treesitter/languagetree.lua
@@ -228,7 +228,6 @@ end
--- determine if any child languages should be created.
---
---@return TSTree[]
----@return table|nil Change list
function LanguageTree:parse()
if self:is_valid() then
self:_log('valid')
@@ -302,18 +301,12 @@ function LanguageTree:parse()
})
self:for_each_child(function(child)
- local _, child_changes = 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
+ child:parse()
end)
self._valid = true
- return self._trees, changes
+ return self._trees
end
--- Invokes the callback for each |LanguageTree| and its children recursively