Skip to content

Commit 40030ae

Browse files
committed
fix(dir-filter): look for first parent project
In order to see if the directory should be scanned we need to check upward for the first project (assuming that no file can be contained within two or more projects at the same time). Furthermore Ive changed some variable names and added a log if the directory is ignored because it is determined not to be from the solution project.
1 parent 3c451ec commit 40030ae

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

lua/neotest-vstest/init.lua

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,23 +155,30 @@ local function create_adapter(config)
155155
local project_files = vim.fs.find(function(path, _)
156156
return path:match("%.[cf]sproj$")
157157
end, {
158-
upward = false,
158+
upward = true,
159159
type = "file",
160160
path = fullpath,
161-
limit = math.huge,
161+
limit = 1,
162162
})
163163

164164
return vim
165165
.iter(solution_info and solution_info.projects or {})
166166
:map(function(proj)
167167
return proj.proj_file
168168
end)
169-
:any(function(proj_file)
170-
for _, file in ipairs(project_files) do
171-
if vim.fs.normalize(proj_file) == vim.fs.normalize(file) then
169+
:any(function(sln_project_file)
170+
for _, project_file in ipairs(project_files) do
171+
if vim.fs.normalize(sln_project_file) == vim.fs.normalize(project_file) then
172172
return true
173173
end
174174
end
175+
logger.debug(
176+
string.format(
177+
"neotest-vstest: file '%s' is not a part of the solution '%s'",
178+
rel_path,
179+
solution_info.solution_file
180+
)
181+
)
175182
return false
176183
end)
177184
else

0 commit comments

Comments
 (0)