Skip to content

Commit 3d0c043

Browse files
committed
Fix that selection range change could cancel real-time suggestions
1 parent f5ed510 commit 3d0c043

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Core/Sources/Service/RealtimeSuggestionController.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ public class RealtimeSuggestionController {
131131
for await notification in notificationsFromEditor {
132132
guard let self else { return }
133133
try Task.checkCancellation()
134-
await cancelInFlightTasks()
135134

136135
switch notification.name {
137136
case kAXValueChangedNotification:
137+
await cancelInFlightTasks()
138138
self.triggerPrefetchDebounced()
139139
await self.notifyEditingFileChange(editor: focusElement)
140140
case kAXSelectedTextChangedNotification:
@@ -210,7 +210,6 @@ public class RealtimeSuggestionController {
210210
let isEnabled = workspace.isSuggestionFeatureEnabled
211211
if !isEnabled { return }
212212
}
213-
214213
if Task.isCancelled { return }
215214

216215
Logger.service.info("Prefetch suggestions.")

0 commit comments

Comments
 (0)