Skip to content

Commit e62a676

Browse files
authored
check if ghost text index > -1 , fix suggest regression (#281561)
fixes #281560
1 parent f7c2968 commit e62a676

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/vs/workbench/contrib/terminalContrib/suggest/browser/terminalSuggestAddon.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,8 @@ export class SuggestAddon extends Disposable implements ITerminalAddon, ISuggest
307307
const allowFallbackCompletions = explicitlyInvoked || quickSuggestionsConfig.unknown === 'on';
308308
this._logService.trace('SuggestAddon#_handleCompletionProviders provideCompletions');
309309
// Trim ghost text from the prompt value when requesting completions
310-
const promptValue = this._mostRecentPromptInputState?.ghostTextIndex !== undefined ? this._currentPromptInputState.value.substring(0, this._mostRecentPromptInputState?.ghostTextIndex) : this._currentPromptInputState.value;
310+
const ghostTextIndex = this._mostRecentPromptInputState?.ghostTextIndex === undefined ? -1 : this._mostRecentPromptInputState?.ghostTextIndex;
311+
const promptValue = ghostTextIndex > -1 ? this._currentPromptInputState.value.substring(0, ghostTextIndex) : this._currentPromptInputState.value;
311312
const providedCompletions = await this._terminalCompletionService.provideCompletions(promptValue, this._currentPromptInputState.cursorIndex, allowFallbackCompletions, this.shellType, this._capabilities, token, false, doNotRequestExtensionCompletions, explicitlyInvoked);
312313
this._logService.trace('SuggestAddon#_handleCompletionProviders provideCompletions done');
313314

0 commit comments

Comments
 (0)