Skip to content

Commit

Permalink
Merge pull request microsoft#210289 from cpendery/feat/hide-modal
Browse files Browse the repository at this point in the history
fix: terminal suggestions should hide modal when no completions exist
  • Loading branch information
Tyriar authored Apr 15, 2024
2 parents af930dc + 0d6f652 commit 0991535
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ export class SuggestAddon extends Disposable implements ITerminalAddon, ISuggest
}

// Hide and clear model if there are no more items
if ((this._suggestWidget as any)._completionModel?.items.length === 0) {
if (!this._suggestWidget?.hasCompletions()) {
this._additionalInput = undefined;
this.hideSuggestWidget();
// TODO: Don't request every time; refine completions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ export class SimpleSuggestWidget implements IDisposable {
this._completionModel = completionModel;
}

hasCompletions(): boolean {
return this._completionModel?.items.length !== 0;
}

showSuggestions(selectionIndex: number, isFrozen: boolean, isAuto: boolean, cursorPosition: { top: number; left: number; height: number }): void {
this._cursorPosition = cursorPosition;

Expand Down

0 comments on commit 0991535

Please sign in to comment.