Skip to content

Commit

Permalink
fix(positions): handle delete files
Browse files Browse the repository at this point in the history
  • Loading branch information
rcarriga committed Feb 16, 2022
1 parent d00aa1a commit 3244c5e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lua/neotest/lib/positions/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ end
local function update_file_node(dir_tree, file_tree, force)
local existing = dir_tree:get_key(file_tree:data().id)
if not existing then
print(debug.traceback())
error("File " .. file_tree:data().id .. "not in tree")
end
if force or (#existing:children() == 0 and #file_tree:children() > 0) then
Expand All @@ -97,7 +98,7 @@ M.merge = function(orig, new)

if M.contains(new:data(), orig:data()) then
for _, node in orig:iter_nodes() do
if node:data().type == "file" then
if node:data().type == "file" and new:get_key(node:data().id) then
update_file_node(new, node)
end
end
Expand All @@ -106,7 +107,7 @@ M.merge = function(orig, new)
end

for _, node in orig:get_key(new:data().id):iter_nodes() do
if node:data().type == "file" then
if node:data().type == "file" and new:get_key(node:data().id) then
update_file_node(new, node)
end
end
Expand Down

0 comments on commit 3244c5e

Please sign in to comment.