Skip to content

Commit

Permalink
dynamicNode: only update for complete snippet.
Browse files Browse the repository at this point in the history
Should prevent stuff like the entier buffer being copied.
  • Loading branch information
L3MON4D3 committed Sep 22, 2023
1 parent d53e747 commit 6aa3d81
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lua/luasnip/nodes/dynamicNode.lua
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ function DynamicNode:update()
return
end

if not self.parent.snippet:extmarks_valid() then
error("Refusing to update a snippet with invalid extmarks")
end

local tmp
if self.snip then
if not args then
Expand Down Expand Up @@ -428,7 +432,10 @@ function DynamicNode:node_at(pos, mode)
end

function DynamicNode:extmarks_valid()
return node_util.generic_extmarks_valid(self, self.snip)
if self.snip then
return node_util.generic_extmarks_valid(self, self.snip)
end
return true
end

return {
Expand Down

0 comments on commit 6aa3d81

Please sign in to comment.