Skip to content

Commit

Permalink
snippet: correctly propagate exit to child_snippets (and clear them).
Browse files Browse the repository at this point in the history
  • Loading branch information
L3MON4D3 committed Oct 29, 2024
1 parent 3a6c694 commit 3e30ca8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lua/luasnip/nodes/snippet.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1133,12 +1133,12 @@ end

function Snippet:exit()
if self.type == types.snippet then
-- if exit is called, this will not be visited again.
-- Thus, also clean up the child-snippets, which will also not be
-- visited again, since they can only be visited through self.
for _, child in ipairs(self.child_snippets) do
child:exit()
-- insertNode also call exit for their child_snippets, but if we
-- :exit() the whole snippet we can just remove all of them here.
for _, snip in ipairs(self.child_snippets) do
snip:exit()
end
self.child_snippets = {}
end

self.visible = false
Expand Down

0 comments on commit 3e30ca8

Please sign in to comment.