Skip to content

Commit a981420

Browse files
committed
1 parent b7fbcd1 commit a981420

1 file changed

Lines changed: 32 additions & 32 deletions

File tree

src/vs/editor/contrib/suggest/suggestWidget.ts

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -564,50 +564,50 @@ export class SuggestWidget implements IContentWidget, IVirtualDelegate<ICompleti
564564
}
565565

566566
const item = e.elements[0];
567+
const index = e.indexes[0];
567568

568569
this.firstFocusInCurrentList = !this.focusedItem;
569-
if (item === this.focusedItem) {
570-
return;
571-
}
570+
if (item !== this.focusedItem) {
572571

573-
if (this.currentSuggestionDetails) {
574-
this.currentSuggestionDetails.cancel();
575-
this.currentSuggestionDetails = null;
576-
}
577572

578-
const index = e.indexes[0];
573+
if (this.currentSuggestionDetails) {
574+
this.currentSuggestionDetails.cancel();
575+
this.currentSuggestionDetails = null;
576+
}
579577

580-
this.suggestionSupportsAutoAccept.set(!item.suggestion.noAutoAccept);
581578

582-
this.focusedItem = item;
579+
this.suggestionSupportsAutoAccept.set(!item.suggestion.noAutoAccept);
583580

584-
this.list.reveal(index);
581+
this.focusedItem = item;
585582

586-
this.currentSuggestionDetails = createCancelablePromise(token => item.resolve(token));
583+
this.list.reveal(index);
587584

588-
this.currentSuggestionDetails.then(() => {
589-
if (this.list.length < index) {
590-
return;
591-
}
585+
this.currentSuggestionDetails = createCancelablePromise(token => item.resolve(token));
592586

593-
// item can have extra information, so re-render
594-
this.ignoreFocusEvents = true;
595-
this.list.splice(index, 1, [item]);
596-
this.list.setFocus([index]);
597-
this.ignoreFocusEvents = false;
587+
this.currentSuggestionDetails.then(() => {
588+
if (this.list.length < index) {
589+
return;
590+
}
598591

599-
if (this.expandDocsSettingFromStorage()) {
600-
this.showDetails();
601-
} else {
602-
removeClass(this.element, 'docs-side');
603-
}
592+
// item can have extra information, so re-render
593+
this.ignoreFocusEvents = true;
594+
this.list.splice(index, 1, [item]);
595+
this.list.setFocus([index]);
596+
this.ignoreFocusEvents = false;
604597

605-
this._ariaAlert(this._getSuggestionAriaAlertLabel(item));
606-
}).catch(onUnexpectedError).then(() => {
607-
if (this.focusedItem === item) {
608-
this.currentSuggestionDetails = null;
609-
}
610-
});
598+
if (this.expandDocsSettingFromStorage()) {
599+
this.showDetails();
600+
} else {
601+
removeClass(this.element, 'docs-side');
602+
}
603+
604+
this._ariaAlert(this._getSuggestionAriaAlertLabel(item));
605+
}).catch(onUnexpectedError).then(() => {
606+
if (this.focusedItem === item) {
607+
this.currentSuggestionDetails = null;
608+
}
609+
});
610+
}
611611

612612
// emit an event
613613
this.onDidFocusEmitter.fire({ item, index, model: this.completionModel });

0 commit comments

Comments
 (0)