From ee97820925ee633cbe2521ccffd7dbf80fa08f83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B3n=C3=A1n=20Carrigan?= Date: Fri, 15 Jul 2022 09:38:15 +0100 Subject: [PATCH] fix(client): discover dirs under root --- lua/neotest/client/init.lua | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/lua/neotest/client/init.lua b/lua/neotest/client/init.lua index fd9ac020..60626627 100644 --- a/lua/neotest/client/init.lua +++ b/lua/neotest/client/init.lua @@ -274,12 +274,21 @@ function NeotestClient:_get_adapter(position_id, adapter_id, refresh) end end end - for _, adapter in ipairs(self._adapters) do - if - self._state:positions(adapter.name, position_id) - or (not lib.files.is_dir(position_id) and adapter.is_test_file(position_id)) - then - return adapter.name, adapter + if not lib.files.is_dir(position_id) then + for _, adapter in ipairs(self._adapters) do + if + self._state:positions(adapter.name, position_id) + or (not lib.files.is_dir(position_id) and adapter.is_test_file(position_id)) + then + return adapter.name, adapter + end + end + else + for _, adapter in ipairs(self._adapters) do + local root = self._state:positions(adapter.name) + if vim.startswith(position_id, root:data().path) then + return adapter.name, adapter + end end end