Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion test/FsAutoComplete.Tests.Lsp/Helpers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,20 @@ let dotnetCleanup baseDir =
[ "obj"; "bin" ]
|> List.map (fun f -> Path.Combine(baseDir, f))
|> List.filter Directory.Exists
|> List.iter (fun path -> Directory.Delete(path, true))
|> List.iter (fun path ->
try
Directory.Delete(path, true)
with _ ->
// On some platforms (e.g., macOS with .NET 10), the recursive delete can
// transiently fail with "Directory not empty" due to background .NET SDK processes
// still holding locks. Retry once after a short pause.
try
System.Threading.Thread.Sleep(200)
Directory.Delete(path, true)
with ex ->
// If cleanup still fails, log and continue. Stale build artifacts are not critical
// and the test should still run correctly against pre-existing output.
eprintfn $"Warning: dotnetCleanup could not delete {path}: {ex.Message}")

let runProcess (workingDir: string) (exePath: string) (args: string) =
async {
Expand Down
4 changes: 3 additions & 1 deletion test/FsAutoComplete.Tests.Lsp/Utils/Server.fs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,9 @@ module Document =

let! result = tcs.Task |> Async.AwaitTask

return result |> Seq.last
// When no publishDiagnostics notifications arrive (e.g. error-free code), the buffer
// can be empty. Use tryLast to return an empty array instead of throwing.
return result |> Seq.tryLast |> Option.defaultValue [||]
}


Expand Down
Loading