Skip to content

Commit

Permalink
fix: avoid running discovery twice
Browse files Browse the repository at this point in the history
Previously found adapters shouldn't have their discovery run twice on
startup.

See #13
  • Loading branch information
rcarriga committed Oct 6, 2022
1 parent e7a9cf3 commit e2d1378
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions lua/neotest/client/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -454,11 +454,11 @@ function NeotestClient:_update_adapters(dir)
if not found[adapter_id] then
self._adapters[adapter_id] = adapter
found[adapter_id] = true
end
if config.projects[root].discovery.enabled then
self:_update_positions(root, { adapter = adapter_id })
else
self:_update_open_buf_positions(adapter_id)
if config.projects[root].discovery.enabled then
self:_update_positions(root, { adapter = adapter_id })
else
self:_update_open_buf_positions(adapter_id)
end
end
end
local root = lib.files.is_dir(dir) and dir or async.fn.getcwd()
Expand All @@ -467,12 +467,11 @@ function NeotestClient:_update_adapters(dir)
if not found[adapter_id] then
self._adapters[adapter_id] = adapter
found[adapter_id] = true
end

if config.projects[root].discovery.enabled then
self:_update_positions(root, { adapter = adapter_id })
else
self:_update_open_buf_positions(adapter_id)
if config.projects[root].discovery.enabled then
self:_update_positions(root, { adapter = adapter_id })
else
self:_update_open_buf_positions(adapter_id)
end
end
end
end
Expand Down

0 comments on commit e2d1378

Please sign in to comment.