Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only invalidate terminal suggestions when whitespace is encountered #239400

Merged
merged 1 commit into from
Feb 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -322,12 +322,15 @@ export class SuggestAddon extends Disposable implements ITerminalAddon, ISuggest
return;
}

// Hide the widget if the cursor moves to the left of the initial position as the
// completions are no longer valid
// to do: get replacement length to be correct, readd this?
if (this._currentPromptInputState && this._currentPromptInputState.cursorIndex <= this._leadingLineContent.length) {
this.hideSuggestWidget();
return;
// Hide the widget if the cursor moves to the left and invalidates the completions.
// Originally this was to the left of the initial position that the completions were
// requested, but since extensions are expected to allow the client-side to filter, they are
// only invalidated when whitespace is encountered.
if (this._currentPromptInputState && this._currentPromptInputState.cursorIndex < this._leadingLineContent.length) {
if (this._currentPromptInputState.cursorIndex === 0 || this._leadingLineContent[this._currentPromptInputState.cursorIndex - 1].match(/\s/)) {
this.hideSuggestWidget();
return;
}
}

if (this._terminalSuggestWidgetVisibleContextKey.get()) {
Expand Down
Loading