Skip to content

Commit 042d6b2

Browse files
committed
Use correct task group
1 parent aa4a3fd commit 042d6b2

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

CodeEdit/Features/LSP/Service/LSPService.swift

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -300,13 +300,15 @@ final class LSPService: ObservableObject {
300300

301301
/// Goes through all active language servers and attempts to shut them down.
302302
func stopAllServers() async {
303-
// Note: This is no longer a task group for a *REASON*
304-
// The task group for some reason would never return from the `await` suspension point.
305-
for (key, server) in languageClients {
306-
do {
307-
try await server.shutdown()
308-
} catch {
309-
self.logger.warning("Shutting down \(key.languageId.rawValue): Error \(error)")
303+
await withTaskGroup(of: Void.self) { group in
304+
for (key, server) in languageClients {
305+
group.addTask {
306+
do {
307+
try await server.shutdown()
308+
} catch {
309+
self.logger.warning("Shutting down \(key.languageId.rawValue): Error \(error)")
310+
}
311+
}
310312
}
311313
}
312314
languageClients.removeAll()

0 commit comments

Comments
 (0)