File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Sources/CodeEditSourceEditor/CodeSuggestion/Model Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,8 @@ final class SuggestionViewModel: ObservableObject {
3030
3131 self . activeTextView = textView
3232 itemsRequestTask = Task {
33+ defer { itemsRequestTask = nil }
34+
3335 do {
3436 guard let completionItems = await delegate. completionSuggestionsRequested (
3537 textView: textView,
@@ -67,6 +69,8 @@ final class SuggestionViewModel: ObservableObject {
6769 position: CursorPosition ,
6870 close: ( ) -> Void
6971 ) {
72+ guard itemsRequestTask == nil else { return }
73+
7074 if activeTextView !== textView {
7175 close ( )
7276 return
@@ -75,7 +79,8 @@ final class SuggestionViewModel: ObservableObject {
7579 guard let newItems = delegate. completionOnCursorMove (
7680 textView: textView,
7781 cursorPosition: position
78- ) else {
82+ ) ,
83+ !newItems. isEmpty else {
7984 close ( )
8085 return
8186 }
You can’t perform that action at this time.
0 commit comments