diff --git a/extensions/terminal-suggest/src/test/terminalSuggestMain.test.ts b/extensions/terminal-suggest/src/test/terminalSuggestMain.test.ts index 9f3c327d953..d13f45a28c6 100644 --- a/extensions/terminal-suggest/src/test/terminalSuggestMain.test.ts +++ b/extensions/terminal-suggest/src/test/terminalSuggestMain.test.ts @@ -92,7 +92,7 @@ suite('Terminal Suggest', () => { const prefix = commandLine.slice(0, cursorPosition).split(' ').at(-1) || ''; const filesRequested = testSpec.expectedResourceRequests?.type === 'files' || testSpec.expectedResourceRequests?.type === 'both'; const foldersRequested = testSpec.expectedResourceRequests?.type === 'folders' || testSpec.expectedResourceRequests?.type === 'both'; - const terminalContext = { commandLine, cursorPosition }; + const terminalContext = { commandLine, cursorPosition, allowFallbackCompletions: true }; const result = await getCompletionItemsFromSpecs( completionSpecs, terminalContext, diff --git a/src/vs/workbench/contrib/terminalContrib/suggest/browser/terminalSuggestAddon.ts b/src/vs/workbench/contrib/terminalContrib/suggest/browser/terminalSuggestAddon.ts index ca00f1e3d0c..559b514cd55 100644 --- a/src/vs/workbench/contrib/terminalContrib/suggest/browser/terminalSuggestAddon.ts +++ b/src/vs/workbench/contrib/terminalContrib/suggest/browser/terminalSuggestAddon.ts @@ -237,7 +237,8 @@ export class SuggestAddon extends Disposable implements ITerminalAddon, ISuggest }; this._requestedCompletionsIndex = this._currentPromptInputState.cursorIndex; - const allowFallbackCompletions = explicitlyInvoked || this._configurationService.getValue(terminalSuggestConfigSection).quickSuggestions?.unknown === 'on'; + const quickSuggestionsConfig = this._configurationService.getValue(terminalSuggestConfigSection).quickSuggestions; + const allowFallbackCompletions = explicitlyInvoked || quickSuggestionsConfig === true || typeof quickSuggestionsConfig === 'object' && quickSuggestionsConfig.unknown === 'on'; const providedCompletions = await this._terminalCompletionService.provideCompletions(this._currentPromptInputState.prefix, this._currentPromptInputState.cursorIndex, allowFallbackCompletions, this.shellType, this._capabilities, token, doNotRequestExtensionCompletions); if (token.isCancellationRequested) { @@ -362,8 +363,9 @@ export class SuggestAddon extends Disposable implements ITerminalAddon, ISuggest if (!this._terminalSuggestWidgetVisibleContextKey.get()) { const commandLineHasSpace = promptInputState.prefix.trim().match(/\s/); if ( - (!commandLineHasSpace && config.quickSuggestions.commands !== 'off') || - (commandLineHasSpace && config.quickSuggestions.arguments !== 'off') + (typeof config.quickSuggestions === 'boolean' && config.quickSuggestions) || + (typeof config.quickSuggestions === 'object' && !commandLineHasSpace && config.quickSuggestions.commands !== 'off') || + (typeof config.quickSuggestions === 'object' && commandLineHasSpace && config.quickSuggestions.arguments !== 'off') ) { if (promptInputState.prefix.match(/[^\s]$/)) { if (!this._wasLastInputArrowKey()) { diff --git a/src/vs/workbench/contrib/terminalContrib/suggest/common/terminalSuggestConfiguration.ts b/src/vs/workbench/contrib/terminalContrib/suggest/common/terminalSuggestConfiguration.ts index 1d0d40e9d2c..db600bb842b 100644 --- a/src/vs/workbench/contrib/terminalContrib/suggest/common/terminalSuggestConfiguration.ts +++ b/src/vs/workbench/contrib/terminalContrib/suggest/common/terminalSuggestConfiguration.ts @@ -43,7 +43,7 @@ export const terminalSuggestConfigSection = 'terminal.integrated.suggest'; export interface ITerminalSuggestConfiguration { enabled: boolean; - quickSuggestions: { + quickSuggestions: /*Legacy - was this when experimental*/boolean | { commands: 'off' | 'on'; arguments: 'off' | 'on'; unknown: 'off' | 'on';