Skip to content

Commit f2671b4

Browse files
committed
Fix accepting suggestions when completion panel is open can fail
1 parent 657aca5 commit f2671b4

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Core/Sources/Service/SuggestionCommandHandler/WindowBaseCommandHandler.swift

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,17 @@ struct WindowBaseCommandHandler: SuggestionCommandHandler {
139139
func acceptSuggestion(editor: EditorContent) async throws -> UpdatedContent? {
140140
presenter.markAsProcessing(true)
141141
defer { presenter.markAsProcessing(false) }
142-
Task {
143-
let fileURL = try await Environment.fetchCurrentFileURL()
144-
presenter.discardSuggestion(fileURL: fileURL)
142+
143+
do {
144+
let result = try await CommentBaseCommandHandler().acceptSuggestion(editor: editor)
145+
Task {
146+
let fileURL = try await Environment.fetchCurrentFileURL()
147+
presenter.discardSuggestion(fileURL: fileURL)
148+
}
149+
return result
150+
} catch {
151+
throw error
145152
}
146-
return try await CommentBaseCommandHandler().acceptSuggestion(editor: editor)
147153
}
148154

149155
func presentRealtimeSuggestions(editor: EditorContent) async throws -> UpdatedContent? {

0 commit comments

Comments
 (0)