From 2c265b30f3cdae9c249c8f9a04541bdaa5d0fa29 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Fri, 19 Jul 2024 07:10:02 -0700 Subject: [PATCH] Use terminal suggest trigger chars even when widget is visible Fixes #222187 --- .../suggest/browser/terminalSuggestAddon.ts | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/vs/workbench/contrib/terminalContrib/suggest/browser/terminalSuggestAddon.ts b/src/vs/workbench/contrib/terminalContrib/suggest/browser/terminalSuggestAddon.ts index c31e0bce9a2..0a441f3cacc 100644 --- a/src/vs/workbench/contrib/terminalContrib/suggest/browser/terminalSuggestAddon.ts +++ b/src/vs/workbench/contrib/terminalContrib/suggest/browser/terminalSuggestAddon.ts @@ -184,12 +184,11 @@ export class SuggestAddon extends Disposable implements ITerminalAddon, ISuggest private _sync(promptInputState: IPromptInputModelState): void { const config = this._configurationService.getValue(terminalSuggestConfigSection); - if (!this._terminalSuggestWidgetVisibleContextKey.get()) { - // If input has been added - if (!this._mostRecentPromptInputState || promptInputState.cursorIndex > this._mostRecentPromptInputState.cursorIndex) { - let sent = false; - - // Quick suggestions + // If input has been added + let sent = false; + if (!this._mostRecentPromptInputState || promptInputState.cursorIndex > this._mostRecentPromptInputState.cursorIndex) { + // Quick suggestions + if (!this._terminalSuggestWidgetVisibleContextKey.get()) { if (config.quickSuggestions) { const completionPrefix = promptInputState.value.substring(0, promptInputState.cursorIndex); if (promptInputState.cursorIndex === 1 || completionPrefix.match(/([\s\[])[^\s]$/)) { @@ -201,14 +200,14 @@ export class SuggestAddon extends Disposable implements ITerminalAddon, ISuggest } } } + } - // Trigger characters - if (config.suggestOnTriggerCharacters && !sent) { - const lastChar = promptInputState.value.at(promptInputState.cursorIndex - 1); - if (lastChar?.match(/[\\\/\-]/)) { - this._requestCompletions(); - sent = true; - } + // Trigger characters - this happens even if the widget is showing + if (config.suggestOnTriggerCharacters && !sent) { + const lastChar = promptInputState.value.at(promptInputState.cursorIndex - 1); + if (lastChar?.match(/[\\\/\-]/)) { + this._requestCompletions(); + sent = true; } } }