@@ -204,7 +204,11 @@ export class SimpleSuggestWidget implements IDisposable {
204
204
205
205
private _cursorPosition ?: { top : number ; left : number ; height : number } ;
206
206
207
- showSuggestions ( completionModel : SimpleCompletionModel , selectionIndex : number , isFrozen : boolean , isAuto : boolean , cursorPosition : { top : number ; left : number ; height : number } ) : void {
207
+ setCompletionModel ( completionModel : SimpleCompletionModel ) {
208
+ this . _completionModel = completionModel ;
209
+ }
210
+
211
+ showSuggestions ( selectionIndex : number , isFrozen : boolean , isAuto : boolean , cursorPosition : { top : number ; left : number ; height : number } ) : void {
208
212
this . _cursorPosition = cursorPosition ;
209
213
210
214
// this._contentWidget.setPosition(this.editor.getPosition());
@@ -213,16 +217,12 @@ export class SimpleSuggestWidget implements IDisposable {
213
217
// this._currentSuggestionDetails?.cancel();
214
218
// this._currentSuggestionDetails = undefined;
215
219
216
- if ( this . _completionModel !== completionModel ) {
217
- this . _completionModel = completionModel ;
218
- }
219
-
220
220
if ( isFrozen && this . _state !== State . Empty && this . _state !== State . Hidden ) {
221
221
this . _setState ( State . Frozen ) ;
222
222
return ;
223
223
}
224
224
225
- const visibleCount = this . _completionModel . items . length ;
225
+ const visibleCount = this . _completionModel ? .items . length ?? 0 ;
226
226
const isEmpty = visibleCount === 0 ;
227
227
// this._ctxSuggestWidgetMultipleSuggestions.set(visibleCount > 1);
228
228
@@ -241,7 +241,7 @@ export class SimpleSuggestWidget implements IDisposable {
241
241
// this._onDidFocus.pause();
242
242
// this._onDidSelect.pause();
243
243
try {
244
- this . _list . splice ( 0 , this . _list . length , this . _completionModel . items ) ;
244
+ this . _list . splice ( 0 , this . _list . length , this . _completionModel ? .items ?? [ ] ) ;
245
245
this . _setState ( isFrozen ? State . Frozen : State . Open ) ;
246
246
this . _list . reveal ( selectionIndex , 0 ) ;
247
247
this . _list . setFocus ( [ selectionIndex ] ) ;
0 commit comments