Skip to content

Commit edb1531

Browse files
committed
Update cleaner to handle builtin extensions
1 parent 65a07ef commit edb1531

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

Core/Package.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ let package = Package(
184184
.target(
185185
name: "SuggestionService",
186186
dependencies: [
187+
.product(name: "UserDefaultsObserver", package: "Tool"),
188+
.product(name: "Preferences", package: "Tool"),
187189
.product(name: "SuggestionModel", package: "Tool"),
188190
.product(name: "SuggestionProvider", package: "Tool")
189191
].pro([

Core/Sources/Service/ScheduledCleaner.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import ActiveApplicationMonitor
22
import AppKit
33
import AXExtension
4+
import BuiltinExtension
45
import Foundation
56
import Logger
67
import Workspace
@@ -32,7 +33,7 @@ public final class ScheduledCleaner {
3233
@ServiceActor
3334
func cleanUp() async {
3435
guard let service else { return }
35-
36+
3637
let workspaceInfos = XcodeInspector.shared.xcodes.reduce(
3738
into: [
3839
XcodeAppInstanceInspector.WorkspaceIdentifier:
@@ -82,18 +83,15 @@ public final class ScheduledCleaner {
8283
await workspace.cleanUp(availableTabs: tabs)
8384
}
8485
}
85-
86+
8687
#if canImport(ProService)
8788
await service.proService.cleanUp(workspaceInfos: workspaceInfos)
8889
#endif
8990
}
9091

9192
@ServiceActor
9293
public func closeAllChildProcesses() async {
93-
guard let service else { return }
94-
for (_, workspace) in service.workspacePool.workspaces {
95-
await workspace.terminateSuggestionService()
96-
}
94+
BuiltinExtensionManager.shared.terminate()
9795
}
9896
}
9997

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
import Foundation
2-
import Workspace
32
import SuggestionProvider
3+
import Workspace
44
import WorkspaceSuggestionService
55

66
extension Workspace {
77
@WorkspaceActor
88
func cleanUp(availableTabs: Set<String>) {
99
for (fileURL, _) in filespaces {
1010
if isFilespaceExpired(fileURL: fileURL, availableTabs: availableTabs) {
11-
Task {
12-
try await suggestionService?.notifyCloseTextDocument(fileURL: fileURL)
13-
}
1411
openedFileRecoverableStorage.closeFile(fileURL: fileURL)
1512
closeFilespace(fileURL: fileURL)
1613
}
@@ -26,10 +23,10 @@ extension Workspace {
2623

2724
func cancelInFlightRealtimeSuggestionRequests() async {
2825
guard let suggestionService else { return }
29-
await suggestionService.cancelRequest()
30-
}
31-
32-
func terminateSuggestionService() async {
33-
await suggestionPlugin?.terminateSuggestionService()
26+
await suggestionService.cancelRequest(workspaceInfo: .init(
27+
workspaceURL: workspaceURL,
28+
projectURL: projectRootURL
29+
))
3430
}
3531
}
32+

0 commit comments

Comments
 (0)