Skip to content

Commit 98faf16

Browse files
committed
Fix real-time suggestion animation in window mode
1 parent a134208 commit 98faf16

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

Core/Sources/Service/SuggestionCommandHandler/WindowBaseCommandHandler.swift

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,14 @@ struct WindowBaseCommandHandler: SuggestionCommandHanlder {
2424

2525
private func _presentSuggestions(editor: EditorContent) async throws {
2626
presenter.markAsProcessing(true)
27-
defer { presenter.markAsProcessing(false) }
27+
defer {
28+
presenter.markAsProcessing(false)
29+
Task {
30+
await GraphicalUserInterfaceController.shared
31+
.realtimeSuggestionIndicatorController
32+
.endPrefetchAnimation()
33+
}
34+
}
2835
let fileURL = try await Environment.fetchCurrentFileURL()
2936
let (workspace, filespace) = try await Workspace
3037
.fetchOrCreateWorkspaceIfNeeded(fileURL: fileURL)
@@ -160,12 +167,6 @@ struct WindowBaseCommandHandler: SuggestionCommandHanlder {
160167
func generateRealtimeSuggestions(editor: EditorContent) async throws -> UpdatedContent? {
161168
await GraphicalUserInterfaceController.shared.realtimeSuggestionIndicatorController
162169
.triggerPrefetchAnimation()
163-
defer {
164-
Task {
165-
await GraphicalUserInterfaceController.shared.realtimeSuggestionIndicatorController
166-
.endPrefetchAnimation()
167-
}
168-
}
169170
return try await presentSuggestions(editor: editor)
170171
}
171172
}

0 commit comments

Comments
 (0)