Skip to content

Commit

Permalink
Rebase against the upstream 89690b9
Browse files Browse the repository at this point in the history
vscode-upstream-sha1: 89690b9
  • Loading branch information
Eclipse Che Sync committed Jul 19, 2024
2 parents 4b138d9 + 89690b9 commit f273f16
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import './debugSettingMigration';
import { ReplAccessibilityHelp } from 'vs/workbench/contrib/debug/browser/replAccessibilityHelp';
import { ReplAccessibilityAnnouncer } from 'vs/workbench/contrib/debug/common/replAccessibilityAnnouncer';
import { RunAndDebugAccessibilityHelp } from 'vs/workbench/contrib/debug/browser/runAndDebugAccessibilityHelp';
import { DebugWatchAccessibilityAnnouncer } from 'vs/workbench/contrib/debug/common/debugAccessibilityAnnouncer';

const debugCategory = nls.localize('debugCategory', "Debug");
registerColors();
Expand Down Expand Up @@ -649,3 +650,4 @@ AccessibleViewRegistry.register(new ReplAccessibleView());
AccessibleViewRegistry.register(new ReplAccessibilityHelp());
AccessibleViewRegistry.register(new RunAndDebugAccessibilityHelp());
registerWorkbenchContribution2(ReplAccessibilityAnnouncer.ID, ReplAccessibilityAnnouncer, WorkbenchPhase.AfterRestored);
registerWorkbenchContribution2(DebugWatchAccessibilityAnnouncer.ID, DebugWatchAccessibilityAnnouncer, WorkbenchPhase.AfterRestored);
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class ReplAccessibilityHelpProvider extends Disposable implements IAccessibleVie

public provideContent(): string {
return [
localize('repl.help', "The debug console is a REPL (Read-Eval-Print-Loop) that allows you to evaluate expressions and run commands and can be focused with{0}.", '<keybinding:workbench.panel.repl.view.focus'),
localize('repl.help', "The debug console is a REPL (Read-Eval-Print-Loop) that allows you to evaluate expressions and run commands and can be focused with{0}.", '<keybinding:workbench.panel.repl.view.focus>'),
localize('repl.output', "The debug console output can be navigated to from the input field with the Focus Previous Widget command{0}.", '<keybinding:widgetNavigation.focusPrevious>'),
localize('repl.input', "The debug console input can be navigated to from the output with the Focus Next Widget command{0}.", '<keybinding:widgetNavigation.focusNext>'),
localize('repl.history', "The debug console output history can be navigated with the up and down arrow keys."),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2092,8 +2092,6 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
this._wrapperElement.classList.add('fixed-dims');
this._hasScrollBar = true;
this._initDimensions();
// Always remove a row to make room for the scroll bar
this._fixedRows = this._rows - 1;
await this._resize();
this._terminalHasFixedWidth.set(true);
if (!this._horizontalScrollbar) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ export class SuggestAddon extends Disposable implements ITerminalAddon, ISuggest
// TODO: Remove these in favor of prompt input state
private _leadingLineContent?: string;
private _cursorIndexDelta: number = 0;
private _lastKeySequence?: string;

private _lastUserDataTimestamp: number = 0;
private _lastAcceptedCompletionTimestamp: number = 0;
private _lastUserData?: string;

static requestCompletionsSequence = '\x1b[24~e'; // F12,e

Expand Down Expand Up @@ -156,7 +159,10 @@ export class SuggestAddon extends Disposable implements ITerminalAddon, ISuggest
this._register(xterm.parser.registerOscHandler(ShellIntegrationOscPs.VSCode, data => {
return this._handleVSCodeSequence(data);
}));
this._register(xterm.onKey(e => this._lastKeySequence = e.key));
this._register(xterm.onData(e => {
this._lastUserData = e;
this._lastUserDataTimestamp = Date.now();
}));
}

setPanel(panel: HTMLElement): void {
Expand All @@ -168,8 +174,11 @@ export class SuggestAddon extends Disposable implements ITerminalAddon, ISuggest
}

private _requestCompletions(): void {
// TODO: Debounce? Prevent this flooding the channel
this._onAcceptedCompletion.fire(SuggestAddon.requestCompletionsSequence);
// Ensure that a key has been pressed since the last accepted completion in order to prevent
// completions being requested again right after accepting a completion
if (this._lastUserDataTimestamp > this._lastAcceptedCompletionTimestamp) {
this._onAcceptedCompletion.fire(SuggestAddon.requestCompletionsSequence);
}
}

private _sync(promptInputState: IPromptInputModelState): void {
Expand All @@ -186,7 +195,7 @@ export class SuggestAddon extends Disposable implements ITerminalAddon, ISuggest
if (promptInputState.cursorIndex === 1 || completionPrefix.match(/([\s\[])[^\s]$/)) {
// Never request completions if the last key sequence was up or down as the user was likely
// navigating history
if (this._lastKeySequence !== /*up*/'\x1b[A' && this._lastKeySequence !== /*down*/'\x1b[B') {
if (this._lastUserData !== /*up*/'\x1b[A' && this._lastUserData !== /*down*/'\x1b[B') {
this._requestCompletions();
sent = true;
}
Expand Down Expand Up @@ -484,6 +493,7 @@ export class SuggestAddon extends Disposable implements ITerminalAddon, ISuggest
if (!suggestion || !initialPromptInputState || !this._leadingLineContent || !this._model) {
return;
}
this._lastAcceptedCompletionTimestamp = Date.now();
this._suggestWidget?.hide();

const currentPromptInputState = this._currentPromptInputState ?? initialPromptInputState;
Expand Down

0 comments on commit f273f16

Please sign in to comment.