From 0fa9d367196603b53a172f3ba4c16883b8a321b9 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 4 May 2021 05:21:49 -0700 Subject: [PATCH 1/5] Add some eslint rules to terminal --- .../workbench/contrib/terminal/.eslintrc.json | 20 + .../terminal/browser/terminalInstance.ts | 18 +- .../terminal/browser/terminalService.ts | 6 +- .../contrib/terminal/browser/terminalTab.ts | 3 +- .../terminal/browser/terminalTabbedView.ts | 2 +- .../terminal/browser/terminalTabsWidget.ts | 2 +- .../browser/terminalTypeAheadAddon.ts | 528 +++++++++--------- .../contrib/terminal/browser/terminalView.ts | 1 + .../terminal/common/terminalEnvironment.ts | 2 +- .../electron-sandbox/localTerminalService.ts | 3 +- .../terminalProfileResolverService.ts | 2 - .../contrib/terminal/node/terminalProfiles.ts | 2 +- .../test/browser/terminalConfigHelper.test.ts | 12 +- .../test/common/terminalColorRegistry.test.ts | 16 +- .../test/common/terminalDataBuffering.test.ts | 2 +- 15 files changed, 320 insertions(+), 299 deletions(-) create mode 100644 src/vs/workbench/contrib/terminal/.eslintrc.json diff --git a/src/vs/workbench/contrib/terminal/.eslintrc.json b/src/vs/workbench/contrib/terminal/.eslintrc.json new file mode 100644 index 0000000000000..32c7e99a15f4b --- /dev/null +++ b/src/vs/workbench/contrib/terminal/.eslintrc.json @@ -0,0 +1,20 @@ +{ + "rules": { + "prefer-const": "warn", + "@typescript-eslint/naming-convention": [ + "warn", + // variableLike + { "selector": "variable", "format": ["camelCase", "UPPER_CASE", "PascalCase"] }, + { "selector": "variable", "filter": "^I.+Service$", "format": ["PascalCase"], "prefix": ["I"] }, + // memberLike + { "selector": "memberLike", "modifiers": ["private"], "format": ["camelCase"], "leadingUnderscore": "require" }, + { "selector": "memberLike", "modifiers": ["protected"], "format": ["camelCase"], "leadingUnderscore": "require" }, + { "selector": "enumMember", "format": ["PascalCase"] }, + // memberLike - Allow enum-like objects to use UPPER_CASE + { "selector": "method", "modifiers": ["public"], "format": ["camelCase", "UPPER_CASE"] }, + // typeLike + { "selector": "typeLike", "format": ["PascalCase"] }, + { "selector": "interface", "format": ["PascalCase"] } + ] + } +} diff --git a/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts b/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts index 13ec3a57f7e4d..2b515588e2849 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts @@ -85,8 +85,6 @@ interface IGridDimensions { } export class TerminalInstance extends Disposable implements ITerminalInstance { - private static readonly EOL_REGEX = /\r?\n/g; - private static _lastKnownCanvasDimensions: ICanvasDimensions | undefined; private static _lastKnownGridDimensions: IGridDimensions | undefined; private static _instanceIdCounter = 1; @@ -135,7 +133,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { private _timeoutDimension: dom.Dimension | undefined; - private hasHadInput: boolean; + private _hasHadInput: boolean; public readonly statusList: ITerminalStatusList = new TerminalStatusList(); public disableLayout: boolean; @@ -248,7 +246,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { this._isDisposed = false; this._instanceId = TerminalInstance._instanceIdCounter++; - this.hasHadInput = false; + this._hasHadInput = false; this._titleReadyPromise = new Promise(c => { this._titleReadyComplete = c; }); @@ -491,8 +489,8 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { this._xtermCore = (xterm as any)._core as XTermCore; this._updateUnicodeVersion(); this.updateAccessibilitySupport(); - this._terminalInstanceService.getXtermSearchConstructor().then(Addon => { - this._xtermSearch = new Addon(); + this._terminalInstanceService.getXtermSearchConstructor().then(addonCtor => { + this._xtermSearch = new addonCtor(); xterm.loadAddon(this._xtermSearch); }); if (this._shellLaunchConfig.initialText) { @@ -586,7 +584,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { this._container.appendChild(this._wrapperElement); } - public async _attachToElement(container: HTMLElement): Promise { + private async _attachToElement(container: HTMLElement): Promise { const xterm = await this._xtermReadyPromise; if (this._wrapperElement) { @@ -645,7 +643,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { !event.ctrlKey && !event.shiftKey && !event.altKey) { - this.hasHadInput = true; + this._hasHadInput = true; } // for keyboard events that resolve to commands described @@ -653,7 +651,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { if (resolveResult && resolveResult.commandId && this._skipTerminalCommands.some(k => k === resolveResult.commandId) && !this._configHelper.config.sendKeybindingsToShell) { // don't alert when terminal is opened or closed if (this._storageService.getBoolean(SHOW_TERMINAL_CONFIG_PROMPT_KEY, StorageScope.GLOBAL, true) && - this.hasHadInput && + this._hasHadInput && !TERMINAL_CREATION_COMMANDS.includes(resolveResult.commandId)) { this._notificationService.prompt( Severity.Info, @@ -942,7 +940,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { public async sendText(text: string, addNewLine: boolean): Promise { // Normalize line endings to 'enter' press. - text = text.replace(TerminalInstance.EOL_REGEX, '\r'); + text = text.replace(/\r?\n/g, '\r'); if (addNewLine && text.substr(text.length - 1) !== '\r') { text += '\r'; } diff --git a/src/vs/workbench/contrib/terminal/browser/terminalService.ts b/src/vs/workbench/contrib/terminal/browser/terminalService.ts index f7c1d866b92f6..947ef726bce7a 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalService.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalService.ts @@ -236,7 +236,7 @@ export class TerminalService implements ITerminalService { this._telemetryService.publicLog('terminalReconnection', data); // now that terminals have been restored, // attach listeners to update remote when terminals are changed - this.attachProcessLayoutListeners(true); + this._attachProcessLayoutListeners(true); } private async _reconnectToLocalTerminals(): Promise { @@ -250,7 +250,7 @@ export class TerminalService implements ITerminalService { } // now that terminals have been restored, // attach listeners to update local state when terminals are changed - this.attachProcessLayoutListeners(false); + this._attachProcessLayoutListeners(false); } private _recreateTerminalTabs(layoutInfo?: ITerminalsLayoutInfo): number { @@ -292,7 +292,7 @@ export class TerminalService implements ITerminalService { return reconnectCounter; } - private attachProcessLayoutListeners(isRemote: boolean): void { + private _attachProcessLayoutListeners(isRemote: boolean): void { this.onActiveTabChanged(() => isRemote ? this._updateRemoteState() : this._updateLocalState()); this.onActiveInstanceChanged(() => isRemote ? this._updateRemoteState() : this._updateLocalState()); this.onInstancesChanged(() => isRemote ? this._updateRemoteState() : this._updateLocalState()); diff --git a/src/vs/workbench/contrib/terminal/browser/terminalTab.ts b/src/vs/workbench/contrib/terminal/browser/terminalTab.ts index b8c3628e45f83..c18919b3d78af 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalTab.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalTab.ts @@ -229,7 +229,6 @@ class SplitPane implements IView { export class TerminalTab extends Disposable implements ITerminalTab { private _terminalInstances: ITerminalInstance[] = []; private _splitPaneContainer: SplitPaneContainer | undefined; - private get splitPaneContainer(): SplitPaneContainer | undefined { return this._splitPaneContainer; } private _tabElement: HTMLElement | undefined; private _panelPosition: Position = Position.BOTTOM; private _terminalLocation: ViewContainerLocation = ViewContainerLocation.Panel; @@ -300,7 +299,7 @@ export class TerminalTab extends Disposable implements ITerminalTab { } public getLayoutInfo(isActive: boolean): ITerminalTabLayoutInfoById { - const isHorizontal = this.splitPaneContainer?.orientation === Orientation.HORIZONTAL; + const isHorizontal = this._splitPaneContainer?.orientation === Orientation.HORIZONTAL; const instances = this.terminalInstances.filter(instance => typeof instance.persistentProcessId === 'number' && instance.shouldPersist); const totalSize = instances.map(instance => isHorizontal ? instance.cols : instance.rows).reduce((totalValue, currentValue) => totalValue + currentValue, 0); return { diff --git a/src/vs/workbench/contrib/terminal/browser/terminalTabbedView.ts b/src/vs/workbench/contrib/terminal/browser/terminalTabbedView.ts index c0a9f91081b0f..7cbc200621556 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalTabbedView.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalTabbedView.ts @@ -211,7 +211,7 @@ export class TerminalTabbedView extends Disposable { } private _handleOnDidSashChange(): void { - let widgetWidth = this._splitView.getViewSize(this._tabTreeIndex); + const widgetWidth = this._splitView.getViewSize(this._tabTreeIndex); if (!this._width || widgetWidth <= 0) { return; } diff --git a/src/vs/workbench/contrib/terminal/browser/terminalTabsWidget.ts b/src/vs/workbench/contrib/terminal/browser/terminalTabsWidget.ts index 2c54a1d6ce439..92722c2c7acec 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalTabsWidget.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalTabsWidget.ts @@ -223,7 +223,7 @@ class TerminalTabsRenderer implements ITreeRenderer, index: number, template: ITerminalTabEntryTemplate): void { - let instance = node.element; + const instance = node.element; const tab = this._terminalService.getTabForInstance(instance); if (!tab) { diff --git a/src/vs/workbench/contrib/terminal/browser/terminalTypeAheadAddon.ts b/src/vs/workbench/contrib/terminal/browser/terminalTypeAheadAddon.ts index eff79fded362b..b15d409c08d49 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalTypeAheadAddon.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalTypeAheadAddon.ts @@ -81,14 +81,18 @@ class Cursor implements ICoordinate { return { x: this._x, y: this._y, baseY: this._baseY }; } - constructor(public readonly rows: number, public readonly cols: number, private readonly buffer: IBuffer) { - this._x = buffer.cursorX; - this._y = buffer.cursorY; - this._baseY = buffer.baseY; + constructor( + public readonly rows: number, + public readonly cols: number, + private readonly _buffer: IBuffer + ) { + this._x = _buffer.cursorX; + this._y = _buffer.cursorY; + this._baseY = _buffer.baseY; } public getLine() { - return this.buffer.getLine(this._y + this._baseY); + return this._buffer.getLine(this._y + this._baseY); } public getCell(loadInto?: IBufferCell) { @@ -102,7 +106,7 @@ class Cursor implements ICoordinate { } public clone() { - const c = new Cursor(this.rows, this.cols, this.buffer); + const c = new Cursor(this.rows, this.cols, this._buffer); c.moveTo(this); return c; } @@ -218,24 +222,26 @@ class StringReader { public index = 0; public get remaining() { - return this.input.length - this.index; + return this._input.length - this.index; } public get eof() { - return this.index === this.input.length; + return this.index === this._input.length; } public get rest() { - return this.input.slice(this.index); + return this._input.slice(this.index); } - constructor(private readonly input: string) { } + constructor( + private readonly _input: string + ) { } /** * Advances the reader and returns the character if it matches. */ public eatChar(char: string) { - if (this.input[this.index] !== char) { + if (this._input[this.index] !== char) { return; } @@ -247,7 +253,7 @@ class StringReader { * Advances the reader and returns the string if it matches. */ public eatStr(substr: string) { - if (this.input.slice(this.index, substr.length) !== substr) { + if (this._input.slice(this.index, substr.length) !== substr) { return; } @@ -261,7 +267,7 @@ class StringReader { * if it's not a match. */ public eatGradually(substr: string): MatchResult { - let prevIndex = this.index; + const prevIndex = this.index; for (let i = 0; i < substr.length; i++) { if (i > 0 && this.eof) { return MatchResult.Buffer; @@ -280,7 +286,7 @@ class StringReader { * Advances the reader and returns the regex if it matches. */ public eatRe(re: RegExp) { - const match = re.exec(this.input.slice(this.index)); + const match = re.exec(this._input.slice(this.index)); if (!match) { return; } @@ -293,7 +299,7 @@ class StringReader { * Advances the reader and returns the character if the code matches. */ public eatCharCode(min = 0, max = min + 1) { - const code = this.input.charCodeAt(this.index); + const code = this._input.charCodeAt(this.index); if (code < min || code >= max) { return undefined; } @@ -332,13 +338,13 @@ class HardBoundary implements IPrediction { * through its `matches` request. */ class TentativeBoundary implements IPrediction { - private appliedCursor?: Cursor; + private _appliedCursor?: Cursor; constructor(public readonly inner: IPrediction) { } public apply(buffer: IBuffer, cursor: Cursor) { - this.appliedCursor = cursor.clone(); - this.inner.apply(buffer, this.appliedCursor); + this._appliedCursor = cursor.clone(); + this.inner.apply(buffer, this._appliedCursor); return ''; } @@ -348,8 +354,8 @@ class TentativeBoundary implements IPrediction { } public rollForwards(cursor: Cursor, withInput: string) { - if (this.appliedCursor) { - cursor.moveTo(this.appliedCursor); + if (this._appliedCursor) { + cursor.moveTo(this._appliedCursor); } return withInput; @@ -375,7 +381,7 @@ class CharacterPrediction implements IPrediction { oldChar: string; }; - constructor(private readonly style: TypeAheadStyle, private readonly char: string) { } + constructor(private readonly _style: TypeAheadStyle, private readonly _char: string) { } public apply(_: IBuffer, cursor: Cursor) { const cell = cursor.getCell(); @@ -385,7 +391,7 @@ class CharacterPrediction implements IPrediction { cursor.shift(1); - return this.style.apply + this.char + this.style.undo; + return this._style.apply + this._char + this._style.undo; } public rollback(cursor: Cursor) { @@ -407,7 +413,7 @@ class CharacterPrediction implements IPrediction { } public matches(input: StringReader, lookBehind?: IPrediction) { - let startIndex = input.index; + const startIndex = input.index; // remove any styling CSI before checking the char while (input.eatRe(CSI_STYLE_RE)) { } @@ -416,13 +422,13 @@ class CharacterPrediction implements IPrediction { return MatchResult.Buffer; } - if (input.eatChar(this.char)) { + if (input.eatChar(this._char)) { return MatchResult.Success; } if (lookBehind instanceof CharacterPrediction) { // see #112842 - const sillyZshOutcome = input.eatGradually(`\b${lookBehind.char}${this.char}`); + const sillyZshOutcome = input.eatGradually(`\b${lookBehind._char}${this._char}`); if (sillyZshOutcome !== MatchResult.Failure) { return sillyZshOutcome; } @@ -434,14 +440,14 @@ class CharacterPrediction implements IPrediction { } class BackspacePrediction implements IPrediction { - protected appliedAt?: { + protected _appliedAt?: { pos: ICoordinate; oldAttributes: string; oldChar: string; isLastChar: boolean; }; - constructor(private readonly terminal: Terminal) { } + constructor(private readonly _terminal: Terminal) { } public apply(_: IBuffer, cursor: Cursor) { // at eol if everything to the right is whitespace (zsh will emit a "clear line" code in this case) @@ -450,7 +456,7 @@ class BackspacePrediction implements IPrediction { const pos = cursor.coordinate; const move = cursor.shift(-1); const cell = cursor.getCell(); - this.appliedAt = cell + this._appliedAt = cell ? { isLastChar, pos, oldAttributes: attributesToSeq(cell), oldChar: cell.getChars() } : { isLastChar, pos, oldAttributes: '', oldChar: '' }; @@ -458,16 +464,16 @@ class BackspacePrediction implements IPrediction { } public rollback(cursor: Cursor) { - if (!this.appliedAt) { + if (!this._appliedAt) { return ''; // not applied } - const { oldAttributes, oldChar, pos } = this.appliedAt; + const { oldAttributes, oldChar, pos } = this._appliedAt; if (!oldChar) { return cursor.moveTo(pos) + DELETE_CHAR; } - return oldAttributes + oldChar + cursor.moveTo(pos) + attributesToSeq(core(this.terminal)._inputHandler._curAttrData); + return oldAttributes + oldChar + cursor.moveTo(pos) + attributesToSeq(core(this._terminal)._inputHandler._curAttrData); } public rollForwards() { @@ -475,7 +481,7 @@ class BackspacePrediction implements IPrediction { } public matches(input: StringReader) { - if (this.appliedAt?.isLastChar) { + if (this._appliedAt?.isLastChar) { const r1 = input.eatGradually(`\b${CSI}K`); if (r1 !== MatchResult.Failure) { return r1; @@ -492,16 +498,16 @@ class BackspacePrediction implements IPrediction { } class NewlinePrediction implements IPrediction { - protected prevPosition?: ICoordinate; + protected _prevPosition?: ICoordinate; public apply(_: IBuffer, cursor: Cursor) { - this.prevPosition = cursor.coordinate; + this._prevPosition = cursor.coordinate; cursor.move(0, cursor.y + 1); return '\r\n'; } public rollback(cursor: Cursor) { - return this.prevPosition ? cursor.moveTo(this.prevPosition) : ''; + return this._prevPosition ? cursor.moveTo(this._prevPosition) : ''; } public rollForwards() { @@ -519,7 +525,7 @@ class NewlinePrediction implements IPrediction { */ class LinewrapPrediction extends NewlinePrediction implements IPrediction { public override apply(_: IBuffer, cursor: Cursor) { - this.prevPosition = cursor.coordinate; + this._prevPosition = cursor.coordinate; cursor.move(0, cursor.y + 1); return ' \r'; } @@ -538,7 +544,7 @@ class LinewrapPrediction extends NewlinePrediction implements IPrediction { } class CursorMovePrediction implements IPrediction { - private applied?: { + private _applied?: { rollForward: string; prevPosition: number; prevAttrs: string; @@ -546,9 +552,9 @@ class CursorMovePrediction implements IPrediction { }; constructor( - private readonly direction: CursorMoveDirection, - private readonly moveByWords: boolean, - private readonly amount: number, + private readonly _direction: CursorMoveDirection, + private readonly _moveByWords: boolean, + private readonly _amount: number, ) { } public apply(buffer: IBuffer, cursor: Cursor) { @@ -556,7 +562,7 @@ class CursorMovePrediction implements IPrediction { const currentCell = cursor.getCell(); const prevAttrs = currentCell ? attributesToSeq(currentCell) : ''; - const { amount, direction, moveByWords } = this; + const { _amount: amount, _direction: direction, _moveByWords: moveByWords } = this; const delta = direction === CursorMoveDirection.Back ? -1 : 1; const target = cursor.clone(); @@ -568,22 +574,22 @@ class CursorMovePrediction implements IPrediction { target.shift(delta * amount); } - this.applied = { + this._applied = { amount: Math.abs(cursor.x - target.x), prevPosition, prevAttrs, rollForward: cursor.moveTo(target), }; - return this.applied.rollForward; + return this._applied.rollForward; } public rollback(cursor: Cursor) { - if (!this.applied) { + if (!this._applied) { return ''; } - return cursor.move(this.applied.prevPosition, cursor.y) + this.applied.prevAttrs; + return cursor.move(this._applied.prevPosition, cursor.y) + this._applied.prevAttrs; } public rollForwards() { @@ -591,12 +597,12 @@ class CursorMovePrediction implements IPrediction { } public matches(input: StringReader) { - if (!this.applied) { + if (!this._applied) { return MatchResult.Failure; } - const direction = this.direction; - const { amount, rollForward } = this.applied; + const direction = this._direction; + const { amount, rollForward } = this._applied; // arg can be omitted to move one character. We don't eatGradually() here @@ -627,38 +633,38 @@ class CursorMovePrediction implements IPrediction { } export class PredictionStats extends Disposable { - private readonly stats: [latency: number, correct: boolean][] = []; - private index = 0; - private readonly addedAtTime = new WeakMap(); - private readonly changeEmitter = new Emitter(); - public readonly onChange = this.changeEmitter.event; + private readonly _stats: [latency: number, correct: boolean][] = []; + private _index = 0; + private readonly _addedAtTime = new WeakMap(); + private readonly _changeEmitter = new Emitter(); + public readonly onChange = this._changeEmitter.event; /** * Gets the percent (0-1) of predictions that were accurate. */ public get accuracy() { let correctCount = 0; - for (const [, correct] of this.stats) { + for (const [, correct] of this._stats) { if (correct) { correctCount++; } } - return correctCount / (this.stats.length || 1); + return correctCount / (this._stats.length || 1); } /** * Gets the number of recorded stats. */ public get sampleSize() { - return this.stats.length; + return this._stats.length; } /** * Gets latency stats of successful predictions. */ public get latency() { - const latencies = this.stats.filter(([, correct]) => correct).map(([s]) => s).sort(); + const latencies = this._stats.filter(([, correct]) => correct).map(([s]) => s).sort(); return { count: latencies.length, @@ -673,7 +679,7 @@ export class PredictionStats extends Disposable { */ public get maxLatency() { let max = -Infinity; - for (const [latency, correct] of this.stats) { + for (const [latency, correct] of this._stats) { if (correct) { max = Math.max(latency, max); } @@ -684,16 +690,16 @@ export class PredictionStats extends Disposable { constructor(timeline: PredictionTimeline) { super(); - this._register(timeline.onPredictionAdded(p => this.addedAtTime.set(p, Date.now()))); - this._register(timeline.onPredictionSucceeded(this.pushStat.bind(this, true))); - this._register(timeline.onPredictionFailed(this.pushStat.bind(this, false))); + this._register(timeline.onPredictionAdded(p => this._addedAtTime.set(p, Date.now()))); + this._register(timeline.onPredictionSucceeded(this._pushStat.bind(this, true))); + this._register(timeline.onPredictionFailed(this._pushStat.bind(this, false))); } - private pushStat(correct: boolean, prediction: IPrediction) { - const started = this.addedAtTime.get(prediction)!; - this.stats[this.index] = [Date.now() - started, correct]; - this.index = (this.index + 1) % statsBufferSize; - this.changeEmitter.fire(); + private _pushStat(correct: boolean, prediction: IPrediction) { + const started = this._addedAtTime.get(prediction)!; + this._stats[this._index] = [Date.now() - started, correct]; + this._index = (this._index + 1) % statsBufferSize; + this._changeEmitter.fire(); } } @@ -702,12 +708,12 @@ export class PredictionTimeline { * Expected queue of events. Only predictions for the lowest are * written into the terminal. */ - private expected: ({ gen: number; p: IPrediction })[] = []; + private _expected: ({ gen: number; p: IPrediction })[] = []; /** * Current prediction generation. */ - private currentGen = 0; + private _currentGen = 0; /** * Current cursor position -- kept outside the buffer since it can be ahead @@ -728,58 +734,58 @@ export class PredictionTimeline { * Previously sent data that was buffered and should be prepended to the * next input. */ - private inputBuffer?: string; + private _inputBuffer?: string; /** * Whether predictions are echoed to the terminal. If false, predictions * will still be computed internally for latency metrics, but input will * never be adjusted. */ - private showPredictions = false; + private _showPredictions = false; /** * The last successfully-made prediction. */ - private lookBehind?: IPrediction; + private _lookBehind?: IPrediction; - private readonly addedEmitter = new Emitter(); - public readonly onPredictionAdded = this.addedEmitter.event; - private readonly failedEmitter = new Emitter(); - public readonly onPredictionFailed = this.failedEmitter.event; - private readonly succeededEmitter = new Emitter(); - public readonly onPredictionSucceeded = this.succeededEmitter.event; + private readonly _addedEmitter = new Emitter(); + public readonly onPredictionAdded = this._addedEmitter.event; + private readonly _failedEmitter = new Emitter(); + public readonly onPredictionFailed = this._failedEmitter.event; + private readonly _succeededEmitter = new Emitter(); + public readonly onPredictionSucceeded = this._succeededEmitter.event; - private get currentGenerationPredictions() { - return this.expected.filter(({ gen }) => gen === this.expected[0].gen).map(({ p }) => p); + private get _currentGenerationPredictions() { + return this._expected.filter(({ gen }) => gen === this._expected[0].gen).map(({ p }) => p); } public get isShowingPredictions() { - return this.showPredictions; + return this._showPredictions; } public get length() { - return this.expected.length; + return this._expected.length; } - constructor(public readonly terminal: Terminal, private readonly style: TypeAheadStyle) { } + constructor(public readonly terminal: Terminal, private readonly _style: TypeAheadStyle) { } public setShowPredictions(show: boolean) { - if (show === this.showPredictions) { + if (show === this._showPredictions) { return; } // console.log('set predictions:', show); - this.showPredictions = show; + this._showPredictions = show; - const buffer = this.getActiveBuffer(); + const buffer = this._getActiveBuffer(); if (!buffer) { return; } - const toApply = this.currentGenerationPredictions; + const toApply = this._currentGenerationPredictions; if (show) { this.clearCursor(); - this.style.expectIncomingStyle(toApply.reduce((count, p) => p.affectsStyle ? count + 1 : count, 0)); + this._style.expectIncomingStyle(toApply.reduce((count, p) => p.affectsStyle ? count + 1 : count, 0)); this.terminal.write(toApply.map(p => p.apply(buffer, this.physicalCursor(buffer))).join('')); } else { this.terminal.write(toApply.reverse().map(p => p.rollback(this.physicalCursor(buffer))).join('')); @@ -790,13 +796,13 @@ export class PredictionTimeline { * Undoes any predictions written and resets expectations. */ public undoAllPredictions() { - const buffer = this.getActiveBuffer(); - if (this.showPredictions && buffer) { - this.terminal.write(this.currentGenerationPredictions.reverse() + const buffer = this._getActiveBuffer(); + if (this._showPredictions && buffer) { + this.terminal.write(this._currentGenerationPredictions.reverse() .map(p => p.rollback(this.physicalCursor(buffer))).join('')); } - this.expected = []; + this._expected = []; } /** @@ -804,26 +810,26 @@ export class PredictionTimeline { */ public beforeServerInput(input: string): string { const originalInput = input; - if (this.inputBuffer) { - input = this.inputBuffer + input; - this.inputBuffer = undefined; + if (this._inputBuffer) { + input = this._inputBuffer + input; + this._inputBuffer = undefined; } - if (!this.expected.length) { - this.clearPredictionState(); + if (!this._expected.length) { + this._clearPredictionState(); return input; } - const buffer = this.getActiveBuffer(); + const buffer = this._getActiveBuffer(); if (!buffer) { - this.clearPredictionState(); + this._clearPredictionState(); return input; } let output = ''; const reader = new StringReader(input); - const startingGen = this.expected[0].gen; + const startingGen = this._expected[0].gen; const emitPredictionOmitted = () => { const omit = reader.eatRe(PREDICTION_OMIT_RE); if (omit) { @@ -831,13 +837,13 @@ export class PredictionTimeline { } }; - ReadLoop: while (this.expected.length && reader.remaining > 0) { + ReadLoop: while (this._expected.length && reader.remaining > 0) { emitPredictionOmitted(); - const { p: prediction, gen } = this.expected[0]; + const { p: prediction, gen } = this._expected[0]; const cursor = this.physicalCursor(buffer); - let beforeTestReaderIndex = reader.index; - switch (prediction.matches(reader, this.lookBehind)) { + const beforeTestReaderIndex = reader.index; + switch (prediction.matches(reader, this._lookBehind)) { case MatchResult.Success: // if the input character matches what the next prediction expected, undo // the prediction and write the real character out. @@ -849,28 +855,28 @@ export class PredictionTimeline { output += eaten; } - this.succeededEmitter.fire(prediction); - this.lookBehind = prediction; - this.expected.shift(); + this._succeededEmitter.fire(prediction); + this._lookBehind = prediction; + this._expected.shift(); break; case MatchResult.Buffer: // on a buffer, store the remaining data and completely read data // to be output as normal. - this.inputBuffer = input.slice(beforeTestReaderIndex); + this._inputBuffer = input.slice(beforeTestReaderIndex); reader.index = input.length; break ReadLoop; case MatchResult.Failure: // on a failure, roll back all remaining items in this generation // and clear predictions, since they are no longer valid - const rollback = this.expected.filter(p => p.gen === startingGen).reverse(); + const rollback = this._expected.filter(p => p.gen === startingGen).reverse(); output += rollback.map(({ p }) => p.rollback(this.physicalCursor(buffer))).join(''); if (rollback.some(r => r.p.affectsStyle)) { // reading the current style should generally be safe, since predictions // always restore the style if they modify it. output += attributesToSeq(core(this.terminal)._inputHandler._curAttrData); } - this.clearPredictionState(); - this.failedEmitter.fire(prediction); + this._clearPredictionState(); + this._failedEmitter.fire(prediction); break ReadLoop; } } @@ -881,24 +887,24 @@ export class PredictionTimeline { // reset the cursor if (!reader.eof) { output += reader.rest; - this.clearPredictionState(); + this._clearPredictionState(); } // If we passed a generation boundary, apply the current generation's predictions - if (this.expected.length && startingGen !== this.expected[0].gen) { - for (const { p, gen } of this.expected) { - if (gen !== this.expected[0].gen) { + if (this._expected.length && startingGen !== this._expected[0].gen) { + for (const { p, gen } of this._expected) { + if (gen !== this._expected[0].gen) { break; } if (p.affectsStyle) { - this.style.expectIncomingStyle(); + this._style.expectIncomingStyle(); } output += p.apply(buffer, this.physicalCursor(buffer)); } } - if (!this.showPredictions) { + if (!this._showPredictions) { return originalInput; } @@ -920,20 +926,20 @@ export class PredictionTimeline { * Clears any expected predictions and stored state. Should be called when * the pty gives us something we don't recognize. */ - private clearPredictionState() { - this.expected = []; + private _clearPredictionState() { + this._expected = []; this.clearCursor(); - this.lookBehind = undefined; + this._lookBehind = undefined; } /** * Appends a typeahead prediction. */ public addPrediction(buffer: IBuffer, prediction: IPrediction) { - this.expected.push({ gen: this.currentGen, p: prediction }); - this.addedEmitter.fire(prediction); + this._expected.push({ gen: this._currentGen, p: prediction }); + this._addedEmitter.fire(prediction); - if (this.currentGen !== this.expected[0].gen) { + if (this._currentGen !== this._expected[0].gen) { prediction.apply(buffer, this.tentativeCursor(buffer)); return false; } @@ -941,9 +947,9 @@ export class PredictionTimeline { const text = prediction.apply(buffer, this.physicalCursor(buffer)); this._tenativeCursor = undefined; // next read will get or clone the physical cursor - if (this.showPredictions && text) { + if (this._showPredictions && text) { if (prediction.affectsStyle) { - this.style.expectIncomingStyle(); + this._style.expectIncomingStyle(); } // console.log('predict:', JSON.stringify(text)); this.terminal.write(text); @@ -968,7 +974,7 @@ export class PredictionTimeline { applied = this.addPrediction(buffer, new TentativeBoundary(prediction)); prediction.apply(buffer, this.tentativeCursor(buffer)); } - this.currentGen++; + this._currentGen++; return applied; } @@ -976,14 +982,14 @@ export class PredictionTimeline { * Peeks the last prediction written. */ public peekEnd(): IPrediction | undefined { - return this.expected[this.expected.length - 1]?.p; + return this._expected[this._expected.length - 1]?.p; } /** * Peeks the first pending prediction. */ public peekStart(): IPrediction | undefined { - return this.expected[0]?.p; + return this._expected[0]?.p; } /** @@ -991,7 +997,7 @@ export class PredictionTimeline { */ public physicalCursor(buffer: IBuffer) { if (!this._physicalCursor) { - if (this.showPredictions) { + if (this._showPredictions) { flushOutput(this.terminal); } this._physicalCursor = new Cursor(this.terminal.rows, this.terminal.cols, buffer); @@ -1017,7 +1023,7 @@ export class PredictionTimeline { this._tenativeCursor = undefined; } - private getActiveBuffer() { + private _getActiveBuffer() { const buffer = this.terminal.buffer.active; return buffer.type === 'normal' ? buffer : undefined; } @@ -1104,7 +1110,7 @@ const getColorWidth = (params: (number | number[])[], pos: number) => { }; class TypeAheadStyle implements IDisposable { - private static compileArgs(args: ReadonlyArray) { + private static _compileArgs(args: ReadonlyArray) { return `${CSI}${args.join(';')}m`; } @@ -1112,16 +1118,16 @@ class TypeAheadStyle implements IDisposable { * Number of typeahead style arguments we expect to read. If this is 0 and * we see a style coming in, we know that the PTY actually wanted to update. */ - private expectedIncomingStyles = 0; - private applyArgs!: ReadonlyArray; - private originalUndoArgs!: ReadonlyArray; - private undoArgs!: ReadonlyArray; + private _expectedIncomingStyles = 0; + private _applyArgs!: ReadonlyArray; + private _originalUndoArgs!: ReadonlyArray; + private _undoArgs!: ReadonlyArray; public apply!: string; public undo!: string; - private csiHandler?: IDisposable; + private _csiHandler?: IDisposable; - constructor(value: ITerminalConfiguration['localEchoStyle'], private readonly terminal: Terminal) { + constructor(value: ITerminalConfiguration['localEchoStyle'], private readonly _terminal: Terminal) { this.onUpdate(value); } @@ -1130,17 +1136,17 @@ class TypeAheadStyle implements IDisposable { * for it coming in. */ public expectIncomingStyle(n = 1) { - this.expectedIncomingStyles += n * 2; + this._expectedIncomingStyles += n * 2; } /** * Starts tracking for CSI changes in the terminal. */ public startTracking() { - this.expectedIncomingStyles = 0; - this.onDidWriteSGR(attributesToArgs(core(this.terminal)._inputHandler._curAttrData)); - this.csiHandler = this.terminal.parser.registerCsiHandler({ final: 'm' }, args => { - this.onDidWriteSGR(args); + this._expectedIncomingStyles = 0; + this._onDidWriteSGR(attributesToArgs(core(this._terminal)._inputHandler._curAttrData)); + this._csiHandler = this._terminal.parser.registerCsiHandler({ final: 'm' }, args => { + this._onDidWriteSGR(args); return false; }); } @@ -1150,68 +1156,68 @@ class TypeAheadStyle implements IDisposable { */ @debounce(2000) public debounceStopTracking() { - this.stopTracking(); + this._stopTracking(); } /** * @inheritdoc */ public dispose() { - this.stopTracking(); + this._stopTracking(); } - private stopTracking() { - this.csiHandler?.dispose(); - this.csiHandler = undefined; + private _stopTracking() { + this._csiHandler?.dispose(); + this._csiHandler = undefined; } - private onDidWriteSGR(args: (number | number[])[]) { - const originalUndo = this.undoArgs; + private _onDidWriteSGR(args: (number | number[])[]) { + const originalUndo = this._undoArgs; for (let i = 0; i < args.length;) { const px = args[i]; const p = typeof px === 'number' ? px : px[0]; - if (this.expectedIncomingStyles) { - if (arrayHasPrefixAt(args, i, this.undoArgs)) { - this.expectedIncomingStyles--; - i += this.undoArgs.length; + if (this._expectedIncomingStyles) { + if (arrayHasPrefixAt(args, i, this._undoArgs)) { + this._expectedIncomingStyles--; + i += this._undoArgs.length; continue; } - if (arrayHasPrefixAt(args, i, this.applyArgs)) { - this.expectedIncomingStyles--; - i += this.applyArgs.length; + if (arrayHasPrefixAt(args, i, this._applyArgs)) { + this._expectedIncomingStyles--; + i += this._applyArgs.length; continue; } } const width = p === 38 || p === 48 || p === 58 ? getColorWidth(args, i) : 1; - switch (this.applyArgs[0]) { + switch (this._applyArgs[0]) { case 1: if (p === 2) { - this.undoArgs = [22, 2]; + this._undoArgs = [22, 2]; } else if (p === 22 || p === 0) { - this.undoArgs = [22]; + this._undoArgs = [22]; } break; case 2: if (p === 1) { - this.undoArgs = [22, 1]; + this._undoArgs = [22, 1]; } else if (p === 22 || p === 0) { - this.undoArgs = [22]; + this._undoArgs = [22]; } break; case 38: if (p === 0 || p === 39 || p === 100) { - this.undoArgs = [39]; + this._undoArgs = [39]; } else if ((p >= 30 && p <= 38) || (p >= 90 && p <= 97)) { - this.undoArgs = args.slice(i, i + width) as number[]; + this._undoArgs = args.slice(i, i + width) as number[]; } break; default: - if (p === this.applyArgs[0]) { - this.undoArgs = this.applyArgs; + if (p === this._applyArgs[0]) { + this._undoArgs = this._applyArgs; } else if (p === 0) { - this.undoArgs = this.originalUndoArgs; + this._undoArgs = this._originalUndoArgs; } // no-op } @@ -1219,8 +1225,8 @@ class TypeAheadStyle implements IDisposable { i += width; } - if (originalUndo !== this.undoArgs) { - this.undo = TypeAheadStyle.compileArgs(this.undoArgs); + if (originalUndo !== this._undoArgs) { + this.undo = TypeAheadStyle._compileArgs(this._undoArgs); } } @@ -1228,14 +1234,14 @@ class TypeAheadStyle implements IDisposable { * Updates the current typeahead style. */ public onUpdate(style: ITerminalConfiguration['localEchoStyle']) { - const { applyArgs, undoArgs } = this.getArgs(style); - this.applyArgs = applyArgs; - this.undoArgs = this.originalUndoArgs = undoArgs; - this.apply = TypeAheadStyle.compileArgs(this.applyArgs); - this.undo = TypeAheadStyle.compileArgs(this.undoArgs); + const { applyArgs, undoArgs } = this._getArgs(style); + this._applyArgs = applyArgs; + this._undoArgs = this._originalUndoArgs = undoArgs; + this.apply = TypeAheadStyle._compileArgs(this._applyArgs); + this.undo = TypeAheadStyle._compileArgs(this._undoArgs); } - private getArgs(style: ITerminalConfiguration['localEchoStyle']) { + private _getArgs(style: ITerminalConfiguration['localEchoStyle']) { switch (style) { case 'bold': return { applyArgs: [1], undoArgs: [22] }; @@ -1267,64 +1273,64 @@ export const enum CharPredictState { } export class TypeAheadAddon extends Disposable implements ITerminalAddon { - private typeaheadStyle?: TypeAheadStyle; - private typeaheadThreshold = this.config.config.localEchoLatencyThreshold; - private excludeProgramRe = compileExcludeRegexp(this.config.config.localEchoExcludePrograms); - protected lastRow?: { y: number; startingX: number; endingX: number; charState: CharPredictState }; - protected timeline?: PredictionTimeline; - private terminalTitle = ''; + private _typeaheadStyle?: TypeAheadStyle; + private _typeaheadThreshold = this._config.config.localEchoLatencyThreshold; + private _excludeProgramRe = compileExcludeRegexp(this._config.config.localEchoExcludePrograms); + protected _lastRow?: { y: number; startingX: number; endingX: number; charState: CharPredictState }; + protected _timeline?: PredictionTimeline; + private _terminalTitle = ''; public stats?: PredictionStats; /** * Debounce that clears predictions after a timeout if the PTY doesn't apply them. */ - private clearPredictionDebounce?: IDisposable; + private _clearPredictionDebounce?: IDisposable; constructor( - private processManager: ITerminalProcessManager, - private readonly config: TerminalConfigHelper, - @ITelemetryService private readonly telemetryService: ITelemetryService, + private _processManager: ITerminalProcessManager, + private readonly _config: TerminalConfigHelper, + @ITelemetryService private readonly _telemetryService: ITelemetryService, ) { super(); - this._register(toDisposable(() => this.clearPredictionDebounce?.dispose())); + this._register(toDisposable(() => this._clearPredictionDebounce?.dispose())); } public activate(terminal: Terminal): void { - const style = this.typeaheadStyle = this._register(new TypeAheadStyle(this.config.config.localEchoStyle, terminal)); - const timeline = this.timeline = new PredictionTimeline(terminal, this.typeaheadStyle); - const stats = this.stats = this._register(new PredictionStats(this.timeline)); + const style = this._typeaheadStyle = this._register(new TypeAheadStyle(this._config.config.localEchoStyle, terminal)); + const timeline = this._timeline = new PredictionTimeline(terminal, this._typeaheadStyle); + const stats = this.stats = this._register(new PredictionStats(this._timeline)); - timeline.setShowPredictions(this.typeaheadThreshold === 0); - this._register(terminal.onData(e => this.onUserData(e))); + timeline.setShowPredictions(this._typeaheadThreshold === 0); + this._register(terminal.onData(e => this._onUserData(e))); this._register(terminal.onTitleChange(title => { - this.terminalTitle = title; - this.reevaluatePredictorState(stats, timeline); + this._terminalTitle = title; + this._reevaluatePredictorState(stats, timeline); })); this._register(terminal.onResize(() => { timeline.setShowPredictions(false); timeline.clearCursor(); - this.reevaluatePredictorState(stats, timeline); + this._reevaluatePredictorState(stats, timeline); })); - this._register(this.config.onConfigChanged(() => { - style.onUpdate(this.config.config.localEchoStyle); - this.typeaheadThreshold = this.config.config.localEchoLatencyThreshold; - this.excludeProgramRe = compileExcludeRegexp(this.config.config.localEchoExcludePrograms); - this.reevaluatePredictorState(stats, timeline); + this._register(this._config.onConfigChanged(() => { + style.onUpdate(this._config.config.localEchoStyle); + this._typeaheadThreshold = this._config.config.localEchoLatencyThreshold; + this._excludeProgramRe = compileExcludeRegexp(this._config.config.localEchoExcludePrograms); + this._reevaluatePredictorState(stats, timeline); })); - this._register(this.timeline.onPredictionSucceeded(p => { - if (this.lastRow?.charState === CharPredictState.HasPendingChar && isTenativeCharacterPrediction(p) && p.inner.appliedAt) { - if (p.inner.appliedAt.pos.y + p.inner.appliedAt.pos.baseY === this.lastRow.y) { - this.lastRow.charState = CharPredictState.Validated; + this._register(this._timeline.onPredictionSucceeded(p => { + if (this._lastRow?.charState === CharPredictState.HasPendingChar && isTenativeCharacterPrediction(p) && p.inner.appliedAt) { + if (p.inner.appliedAt.pos.y + p.inner.appliedAt.pos.baseY === this._lastRow.y) { + this._lastRow.charState = CharPredictState.Validated; } } })); - this._register(this.processManager.onBeforeProcessData(e => this.onBeforeProcessData(e))); + this._register(this._processManager.onBeforeProcessData(e => this._onBeforeProcessData(e))); let nextStatsSend: any; this._register(stats.onChange(() => { if (!nextStatsSend) { nextStatsSend = setTimeout(() => { - this.sendLatencyStats(stats); + this._sendLatencyStats(stats); nextStatsSend = undefined; }, statsSendTelemetryEvery); } @@ -1333,30 +1339,30 @@ export class TypeAheadAddon extends Disposable implements ITerminalAddon { style.debounceStopTracking(); } - this.reevaluatePredictorState(stats, timeline); + this._reevaluatePredictorState(stats, timeline); })); } public reset() { - this.lastRow = undefined; + this._lastRow = undefined; } - private deferClearingPredictions() { - if (!this.stats || !this.timeline) { + private _deferClearingPredictions() { + if (!this.stats || !this._timeline) { return; } - this.clearPredictionDebounce?.dispose(); - if (this.timeline.length === 0 || this.timeline.peekStart()?.clearAfterTimeout === false) { - this.clearPredictionDebounce = undefined; + this._clearPredictionDebounce?.dispose(); + if (this._timeline.length === 0 || this._timeline.peekStart()?.clearAfterTimeout === false) { + this._clearPredictionDebounce = undefined; return; } - this.clearPredictionDebounce = disposableTimeout( + this._clearPredictionDebounce = disposableTimeout( () => { - this.timeline?.undoAllPredictions(); - if (this.lastRow?.charState === CharPredictState.HasPendingChar) { - this.lastRow.charState = CharPredictState.Unknown; + this._timeline?.undoAllPredictions(); + if (this._lastRow?.charState === CharPredictState.HasPendingChar) { + this._lastRow.charState = CharPredictState.Unknown; } }, Math.max(500, this.stats.maxLatency * 3 / 2), @@ -1371,28 +1377,28 @@ export class TypeAheadAddon extends Disposable implements ITerminalAddon { * terminal cursor is not updated, causes issues. */ @debounce(100) - protected reevaluatePredictorState(stats: PredictionStats, timeline: PredictionTimeline) { - this.reevaluatePredictorStateNow(stats, timeline); + protected _reevaluatePredictorState(stats: PredictionStats, timeline: PredictionTimeline) { + this._reevaluatePredictorStateNow(stats, timeline); } - protected reevaluatePredictorStateNow(stats: PredictionStats, timeline: PredictionTimeline) { - if (this.excludeProgramRe.test(this.terminalTitle)) { + protected _reevaluatePredictorStateNow(stats: PredictionStats, timeline: PredictionTimeline) { + if (this._excludeProgramRe.test(this._terminalTitle)) { timeline.setShowPredictions(false); - } else if (this.typeaheadThreshold < 0) { + } else if (this._typeaheadThreshold < 0) { timeline.setShowPredictions(false); - } else if (this.typeaheadThreshold === 0) { + } else if (this._typeaheadThreshold === 0) { timeline.setShowPredictions(true); } else if (stats.sampleSize > statsMinSamplesToTurnOn && stats.accuracy > statsMinAccuracyToTurnOn) { const latency = stats.latency.median; - if (latency >= this.typeaheadThreshold) { + if (latency >= this._typeaheadThreshold) { timeline.setShowPredictions(true); - } else if (latency < this.typeaheadThreshold / statsToggleOffThreshold) { + } else if (latency < this._typeaheadThreshold / statsToggleOffThreshold) { timeline.setShowPredictions(false); } } } - private sendLatencyStats(stats: PredictionStats) { + private _sendLatencyStats(stats: PredictionStats) { /* __GDPR__ "terminalLatencyStats" : { "min" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "isMeasurement": true }, @@ -1402,20 +1408,20 @@ export class TypeAheadAddon extends Disposable implements ITerminalAddon { "predictionAccuracy" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "isMeasurement": true } } */ - this.telemetryService.publicLog('terminalLatencyStats', { + this._telemetryService.publicLog('terminalLatencyStats', { ...stats.latency, predictionAccuracy: stats.accuracy, }); } - private onUserData(data: string): void { - if (this.timeline?.terminal.buffer.active.type !== 'normal') { + private _onUserData(data: string): void { + if (this._timeline?.terminal.buffer.active.type !== 'normal') { return; } // console.log('user data:', JSON.stringify(data)); - const terminal = this.timeline.terminal; + const terminal = this._timeline.terminal; const buffer = terminal.buffer.active; // Detect programs like git log/less that use the normal buffer but don't @@ -1430,44 +1436,44 @@ export class TypeAheadAddon extends Disposable implements ITerminalAddon { // arrow or backspace-into the prompt. Record the lowest X value at which // the user gave input, and mark all additions before that as tentative. const actualY = buffer.baseY + buffer.cursorY; - if (actualY !== this.lastRow?.y) { - this.lastRow = { y: actualY, startingX: buffer.cursorX, endingX: buffer.cursorX, charState: CharPredictState.Unknown }; + if (actualY !== this._lastRow?.y) { + this._lastRow = { y: actualY, startingX: buffer.cursorX, endingX: buffer.cursorX, charState: CharPredictState.Unknown }; } else { - this.lastRow.startingX = Math.min(this.lastRow.startingX, buffer.cursorX); - this.lastRow.endingX = Math.max(this.lastRow.endingX, this.timeline.physicalCursor(buffer).x); + this._lastRow.startingX = Math.min(this._lastRow.startingX, buffer.cursorX); + this._lastRow.endingX = Math.max(this._lastRow.endingX, this._timeline.physicalCursor(buffer).x); } const addLeftNavigating = (p: IPrediction) => - this.timeline!.tentativeCursor(buffer).x <= this.lastRow!.startingX - ? this.timeline!.addBoundary(buffer, p) - : this.timeline!.addPrediction(buffer, p); + this._timeline!.tentativeCursor(buffer).x <= this._lastRow!.startingX + ? this._timeline!.addBoundary(buffer, p) + : this._timeline!.addPrediction(buffer, p); const addRightNavigating = (p: IPrediction) => - this.timeline!.tentativeCursor(buffer).x >= this.lastRow!.endingX - 1 - ? this.timeline!.addBoundary(buffer, p) - : this.timeline!.addPrediction(buffer, p); + this._timeline!.tentativeCursor(buffer).x >= this._lastRow!.endingX - 1 + ? this._timeline!.addBoundary(buffer, p) + : this._timeline!.addPrediction(buffer, p); /** @see https://github.com/xtermjs/xterm.js/blob/1913e9512c048e3cf56bb5f5df51bfff6899c184/src/common/input/Keyboard.ts */ const reader = new StringReader(data); while (reader.remaining > 0) { if (reader.eatCharCode(127)) { // backspace - const previous = this.timeline.peekEnd(); + const previous = this._timeline.peekEnd(); if (previous && previous instanceof CharacterPrediction) { - this.timeline.addBoundary(); + this._timeline.addBoundary(); } // backspace must be able to read the previously-written character in // the event that it needs to undo it - if (this.timeline.isShowingPredictions) { - flushOutput(this.timeline.terminal); + if (this._timeline.isShowingPredictions) { + flushOutput(this._timeline.terminal); } - if (this.timeline.tentativeCursor(buffer).x <= this.lastRow!.startingX) { - this.timeline.addBoundary(buffer, new BackspacePrediction(this.timeline.terminal)); + if (this._timeline.tentativeCursor(buffer).x <= this._lastRow!.startingX) { + this._timeline.addBoundary(buffer, new BackspacePrediction(this._timeline.terminal)); } else { // Backspace decrements our ability to go right. - this.lastRow.endingX--; - this.timeline!.addPrediction(buffer, new BackspacePrediction(this.timeline.terminal)); + this._lastRow.endingX--; + this._timeline!.addPrediction(buffer, new BackspacePrediction(this._timeline.terminal)); } continue; @@ -1475,16 +1481,16 @@ export class TypeAheadAddon extends Disposable implements ITerminalAddon { if (reader.eatCharCode(32, 126)) { // alphanum const char = data[reader.index - 1]; - const prediction = new CharacterPrediction(this.typeaheadStyle!, char); - if (this.lastRow.charState === CharPredictState.Unknown) { - this.timeline.addBoundary(buffer, prediction); - this.lastRow.charState = CharPredictState.HasPendingChar; + const prediction = new CharacterPrediction(this._typeaheadStyle!, char); + if (this._lastRow.charState === CharPredictState.Unknown) { + this._timeline.addBoundary(buffer, prediction); + this._lastRow.charState = CharPredictState.HasPendingChar; } else { - this.timeline.addPrediction(buffer, prediction); + this._timeline.addPrediction(buffer, prediction); } - if (this.timeline.tentativeCursor(buffer).x >= terminal.cols) { - this.timeline.addBoundary(buffer, new LinewrapPrediction()); + if (this._timeline.tentativeCursor(buffer).x >= terminal.cols) { + this._timeline.addBoundary(buffer, new LinewrapPrediction()); } continue; } @@ -1512,30 +1518,30 @@ export class TypeAheadAddon extends Disposable implements ITerminalAddon { } if (reader.eatChar('\r') && buffer.cursorY < terminal.rows - 1) { - this.timeline.addPrediction(buffer, new NewlinePrediction()); + this._timeline.addPrediction(buffer, new NewlinePrediction()); continue; } // something else - this.timeline.addBoundary(buffer, new HardBoundary()); + this._timeline.addBoundary(buffer, new HardBoundary()); break; } - if (this.timeline.length === 1) { - this.deferClearingPredictions(); - this.typeaheadStyle!.startTracking(); + if (this._timeline.length === 1) { + this._deferClearingPredictions(); + this._typeaheadStyle!.startTracking(); } } - private onBeforeProcessData(event: IBeforeProcessDataEvent): void { - if (!this.timeline) { + private _onBeforeProcessData(event: IBeforeProcessDataEvent): void { + if (!this._timeline) { return; } // console.log('incoming data:', JSON.stringify(event.data)); - event.data = this.timeline.beforeServerInput(event.data); + event.data = this._timeline.beforeServerInput(event.data); // console.log('emitted data:', JSON.stringify(event.data)); - this.deferClearingPredictions(); + this._deferClearingPredictions(); } } diff --git a/src/vs/workbench/contrib/terminal/browser/terminalView.ts b/src/vs/workbench/contrib/terminal/browser/terminalView.ts index aa4cdd7ed50a6..783a7142a7512 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalView.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalView.ts @@ -159,6 +159,7 @@ export class TerminalViewPane extends ViewPane { this._parentDomElement.append(this._tabsViewWrapper); } + // eslint-disable-next-line @typescript-eslint/naming-convention protected override layoutBody(height: number, width: number): void { super.layoutBody(height, width); diff --git a/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts b/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts index d9dfebcc7b575..0e8dbef09996b 100644 --- a/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts +++ b/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts @@ -367,7 +367,7 @@ export function createTerminalEnvironment( baseEnv: IProcessEnvironment ): IProcessEnvironment { // Create a terminal environment based on settings, launch config and permissions - let env: IProcessEnvironment = {}; + const env: IProcessEnvironment = {}; if (shellLaunchConfig.strictEnv) { // strictEnv is true, only use the requested env (ignoring null entries) mergeNonNullKeys(env, shellLaunchConfig.env); diff --git a/src/vs/workbench/contrib/terminal/electron-sandbox/localTerminalService.ts b/src/vs/workbench/contrib/terminal/electron-sandbox/localTerminalService.ts index e1382a3427238..cb2f0859fc26a 100644 --- a/src/vs/workbench/contrib/terminal/electron-sandbox/localTerminalService.ts +++ b/src/vs/workbench/contrib/terminal/electron-sandbox/localTerminalService.ts @@ -150,8 +150,7 @@ export class LocalTerminalService extends Disposable implements ILocalTerminalSe const layoutArgs: IGetTerminalLayoutInfoArgs = { workspaceId: this._getWorkspaceId() }; - let result = await this._localPtyService.getTerminalLayoutInfo(layoutArgs); - return result; + return await this._localPtyService.getTerminalLayoutInfo(layoutArgs); } private _getWorkspaceId(): string { diff --git a/src/vs/workbench/contrib/terminal/electron-sandbox/terminalProfileResolverService.ts b/src/vs/workbench/contrib/terminal/electron-sandbox/terminalProfileResolverService.ts index 3977876099954..f50c41af229af 100644 --- a/src/vs/workbench/contrib/terminal/electron-sandbox/terminalProfileResolverService.ts +++ b/src/vs/workbench/contrib/terminal/electron-sandbox/terminalProfileResolverService.ts @@ -10,7 +10,6 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace import { IRemoteTerminalService, ITerminalService } from 'vs/workbench/contrib/terminal/browser/terminal'; import { BaseTerminalProfileResolverService } from 'vs/workbench/contrib/terminal/browser/terminalProfileResolverService'; import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver'; -import { IShellEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/shellEnvironmentService'; import { IHistoryService } from 'vs/workbench/services/history/common/history'; export class ElectronTerminalProfileResolverService extends BaseTerminalProfileResolverService { @@ -20,7 +19,6 @@ export class ElectronTerminalProfileResolverService extends BaseTerminalProfileR @IConfigurationService configurationService: IConfigurationService, @IHistoryService historyService: IHistoryService, @ILogService logService: ILogService, - @IShellEnvironmentService shellEnvironmentService: IShellEnvironmentService, @ITerminalService terminalService: ITerminalService, @ILocalTerminalService localTerminalService: ILocalTerminalService, @IRemoteTerminalService remoteTerminalService: IRemoteTerminalService, diff --git a/src/vs/workbench/contrib/terminal/node/terminalProfiles.ts b/src/vs/workbench/contrib/terminal/node/terminalProfiles.ts index 4e2eb6e159611..4280148374f35 100644 --- a/src/vs/workbench/contrib/terminal/node/terminalProfiles.ts +++ b/src/vs/workbench/contrib/terminal/node/terminalProfiles.ts @@ -201,7 +201,7 @@ async function getWslProfiles(wslPath: string, useWslProfiles?: boolean): Promis if (distroOutput) { const regex = new RegExp(/[\r?\n]/); const distroNames = distroOutput.split(regex).filter(t => t.trim().length > 0 && t !== ''); - for (let distroName of distroNames) { + for (const distroName of distroNames) { // Skip empty lines if (distroName === '') { continue; diff --git a/src/vs/workbench/contrib/terminal/test/browser/terminalConfigHelper.test.ts b/src/vs/workbench/contrib/terminal/test/browser/terminalConfigHelper.test.ts index b1ddec89424c8..230b0cfe8c776 100644 --- a/src/vs/workbench/contrib/terminal/test/browser/terminalConfigHelper.test.ts +++ b/src/vs/workbench/contrib/terminal/test/browser/terminalConfigHelper.test.ts @@ -167,7 +167,7 @@ suite('Workbench - TerminalConfigHelper', () => { } }); - let configHelper = new TestTerminalConfigHelper(configurationService, null!, null!, null!, null!, null!); + const configHelper = new TestTerminalConfigHelper(configurationService, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.strictEqual(configHelper.configFontIsMonospace(), true, 'monospace is monospaced'); }); @@ -179,7 +179,7 @@ suite('Workbench - TerminalConfigHelper', () => { fontFamily: 'sans-serif' } }); - let configHelper = new TestTerminalConfigHelper(configurationService, null!, null!, null!, null!, null!); + const configHelper = new TestTerminalConfigHelper(configurationService, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.strictEqual(configHelper.configFontIsMonospace(), false, 'sans-serif is not monospaced'); }); @@ -191,7 +191,7 @@ suite('Workbench - TerminalConfigHelper', () => { fontFamily: 'serif' } }); - let configHelper = new TestTerminalConfigHelper(configurationService, null!, null!, null!, null!, null!); + const configHelper = new TestTerminalConfigHelper(configurationService, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.strictEqual(configHelper.configFontIsMonospace(), false, 'serif is not monospaced'); }); @@ -207,7 +207,7 @@ suite('Workbench - TerminalConfigHelper', () => { } }); - let configHelper = new TestTerminalConfigHelper(configurationService, null!, null!, null!, null!, null!); + const configHelper = new TestTerminalConfigHelper(configurationService, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.strictEqual(configHelper.configFontIsMonospace(), true, 'monospace is monospaced'); }); @@ -223,7 +223,7 @@ suite('Workbench - TerminalConfigHelper', () => { } }); - let configHelper = new TestTerminalConfigHelper(configurationService, null!, null!, null!, null!, null!); + const configHelper = new TestTerminalConfigHelper(configurationService, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.strictEqual(configHelper.configFontIsMonospace(), false, 'sans-serif is not monospaced'); }); @@ -239,7 +239,7 @@ suite('Workbench - TerminalConfigHelper', () => { } }); - let configHelper = new TestTerminalConfigHelper(configurationService, null!, null!, null!, null!, null!); + const configHelper = new TestTerminalConfigHelper(configurationService, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.strictEqual(configHelper.configFontIsMonospace(), false, 'serif is not monospaced'); }); diff --git a/src/vs/workbench/contrib/terminal/test/common/terminalColorRegistry.test.ts b/src/vs/workbench/contrib/terminal/test/common/terminalColorRegistry.test.ts index 2524a5ad71352..f0737aa3e5818 100644 --- a/src/vs/workbench/contrib/terminal/test/common/terminalColorRegistry.test.ts +++ b/src/vs/workbench/contrib/terminal/test/common/terminalColorRegistry.test.ts @@ -13,9 +13,9 @@ import { ColorScheme } from 'vs/platform/theme/common/theme'; registerColors(); -let themingRegistry = Registry.as(ThemeingExtensions.ColorContribution); +const themingRegistry = Registry.as(ThemeingExtensions.ColorContribution); function getMockTheme(type: ColorScheme): IColorTheme { - let theme = { + const theme = { selector: '', label: '', type: type, @@ -31,8 +31,8 @@ function getMockTheme(type: ColorScheme): IColorTheme { suite('Workbench - TerminalColorRegistry', () => { test('hc colors', function () { - let theme = getMockTheme(ColorScheme.HIGH_CONTRAST); - let colors = ansiColorIdentifiers.map(colorId => Color.Format.CSS.formatHexA(theme.getColor(colorId)!, true)); + const theme = getMockTheme(ColorScheme.HIGH_CONTRAST); + const colors = ansiColorIdentifiers.map(colorId => Color.Format.CSS.formatHexA(theme.getColor(colorId)!, true)); assert.deepStrictEqual(colors, [ '#000000', @@ -56,8 +56,8 @@ suite('Workbench - TerminalColorRegistry', () => { }); test('light colors', function () { - let theme = getMockTheme(ColorScheme.LIGHT); - let colors = ansiColorIdentifiers.map(colorId => Color.Format.CSS.formatHexA(theme.getColor(colorId)!, true)); + const theme = getMockTheme(ColorScheme.LIGHT); + const colors = ansiColorIdentifiers.map(colorId => Color.Format.CSS.formatHexA(theme.getColor(colorId)!, true)); assert.deepStrictEqual(colors, [ '#000000', @@ -81,8 +81,8 @@ suite('Workbench - TerminalColorRegistry', () => { }); test('dark colors', function () { - let theme = getMockTheme(ColorScheme.DARK); - let colors = ansiColorIdentifiers.map(colorId => Color.Format.CSS.formatHexA(theme.getColor(colorId)!, true)); + const theme = getMockTheme(ColorScheme.DARK); + const colors = ansiColorIdentifiers.map(colorId => Color.Format.CSS.formatHexA(theme.getColor(colorId)!, true)); assert.deepStrictEqual(colors, [ '#000000', diff --git a/src/vs/workbench/contrib/terminal/test/common/terminalDataBuffering.test.ts b/src/vs/workbench/contrib/terminal/test/common/terminalDataBuffering.test.ts index 92ec1097e93a5..01cec8ee267da 100644 --- a/src/vs/workbench/contrib/terminal/test/common/terminalDataBuffering.test.ts +++ b/src/vs/workbench/contrib/terminal/test/common/terminalDataBuffering.test.ts @@ -80,7 +80,7 @@ suite('Workbench - TerminalDataBufferer', () => { }); test('stop', async () => { - let terminalOnData = new Emitter(); + const terminalOnData = new Emitter(); bufferer.startBuffering(1, terminalOnData.event, 0); From a6a9f771adfb744ae40dd3acb6f50304690fcd45 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 4 May 2021 05:24:54 -0700 Subject: [PATCH 2/5] Lint progress --- .../quickinput/browser/commandsQuickAccess.ts | 2 +- .../quickinput/browser/pickerQuickAccess.ts | 4 +-- .../browser/parts/editor/editorQuickAccess.ts | 2 +- .../browser/find/simpleFindWidget.ts | 20 ++++++------ .../contrib/debug/browser/debugQuickAccess.ts | 2 +- .../browser/extensionsQuickAccess.ts | 4 +-- .../quickaccess/browser/viewQuickAccess.ts | 2 +- .../search/browser/anythingQuickAccess.ts | 2 +- .../search/browser/symbolsQuickAccess.ts | 2 +- .../contrib/tasks/browser/tasksQuickAccess.ts | 2 +- .../browser/links/terminalLinkManager.ts | 12 +++---- .../terminal/browser/terminalActions.ts | 6 ++-- .../terminal/browser/terminalConfigHelper.ts | 32 +++++++++---------- .../terminal/browser/terminalFindWidget.ts | 10 +++--- .../browser/terminalProcessManager.ts | 2 +- .../terminal/browser/terminalQuickAccess.ts | 18 +++++------ .../widgets/environmentVariableInfoWidget.ts | 2 +- .../test/browser/terminalTypeahead.test.ts | 16 +++++----- .../webview/browser/webviewFindWidget.ts | 10 +++--- .../test/browser/quickAccess.test.ts | 6 ++-- 20 files changed, 78 insertions(+), 78 deletions(-) diff --git a/src/vs/platform/quickinput/browser/commandsQuickAccess.ts b/src/vs/platform/quickinput/browser/commandsQuickAccess.ts index 68fc5345562a1..e84a282762a26 100644 --- a/src/vs/platform/quickinput/browser/commandsQuickAccess.ts +++ b/src/vs/platform/quickinput/browser/commandsQuickAccess.ts @@ -55,7 +55,7 @@ export abstract class AbstractCommandsQuickAccessProvider extends PickerQuickAcc this.options = options; } - protected async getPicks(filter: string, disposables: DisposableStore, token: CancellationToken): Promise> { + protected async _getPicks(filter: string, disposables: DisposableStore, token: CancellationToken): Promise> { // Ask subclass for all command picks const allCommandPicks = await this.getCommandPicks(disposables, token); diff --git a/src/vs/platform/quickinput/browser/pickerQuickAccess.ts b/src/vs/platform/quickinput/browser/pickerQuickAccess.ts index eb1fe1be25770..52db4d078817d 100644 --- a/src/vs/platform/quickinput/browser/pickerQuickAccess.ts +++ b/src/vs/platform/quickinput/browser/pickerQuickAccess.ts @@ -122,7 +122,7 @@ export abstract class PickerQuickAccessProvider, skipEmpty?: boolean): boolean => { let items: readonly Pick[]; @@ -330,5 +330,5 @@ export abstract class PickerQuickAccessProvider | Promise> | FastAndSlowPicks | null; + protected abstract _getPicks(filter: string, disposables: DisposableStore, token: CancellationToken): Picks | Promise> | FastAndSlowPicks | null; } diff --git a/src/vs/workbench/browser/parts/editor/editorQuickAccess.ts b/src/vs/workbench/browser/parts/editor/editorQuickAccess.ts index a2e88453c0dc4..7f8a6094a07fd 100644 --- a/src/vs/workbench/browser/parts/editor/editorQuickAccess.ts +++ b/src/vs/workbench/browser/parts/editor/editorQuickAccess.ts @@ -68,7 +68,7 @@ export abstract class BaseEditorQuickAccessProvider extends PickerQuickAccessPro return super.provide(picker, token); } - protected getPicks(filter: string): Array { + protected _getPicks(filter: string): Array { const query = prepareQuery(filter); // Filtering diff --git a/src/vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget.ts b/src/vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget.ts index dc1c0e064cbbb..cb02f6275e5e5 100644 --- a/src/vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget.ts +++ b/src/vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget.ts @@ -69,7 +69,7 @@ export abstract class SimpleFindWidget extends Widget { this._updateHistoryDelayer = new Delayer(500); this.oninput(this._findInput.domNode, (e) => { - this.foundMatch = this.onInputChanged(); + this.foundMatch = this._onInputChanged(); this.updateButtons(this.foundMatch); this._delayedUpdateHistory(); }); @@ -138,25 +138,25 @@ export abstract class SimpleFindWidget extends Widget { }); this._focusTracker = this._register(dom.trackFocus(this._innerDomNode)); - this._register(this._focusTracker.onDidFocus(this.onFocusTrackerFocus.bind(this))); - this._register(this._focusTracker.onDidBlur(this.onFocusTrackerBlur.bind(this))); + this._register(this._focusTracker.onDidFocus(this._onFocusTrackerFocus.bind(this))); + this._register(this._focusTracker.onDidBlur(this._onFocusTrackerBlur.bind(this))); this._findInputFocusTracker = this._register(dom.trackFocus(this._findInput.domNode)); - this._register(this._findInputFocusTracker.onDidFocus(this.onFindInputFocusTrackerFocus.bind(this))); - this._register(this._findInputFocusTracker.onDidBlur(this.onFindInputFocusTrackerBlur.bind(this))); + this._register(this._findInputFocusTracker.onDidFocus(this._onFindInputFocusTrackerFocus.bind(this))); + this._register(this._findInputFocusTracker.onDidBlur(this._onFindInputFocusTrackerBlur.bind(this))); this._register(dom.addDisposableListener(this._innerDomNode, 'click', (event) => { event.stopPropagation(); })); } - protected abstract onInputChanged(): boolean; + protected abstract _onInputChanged(): boolean; protected abstract find(previous: boolean): void; protected abstract findFirst(): void; - protected abstract onFocusTrackerFocus(): void; - protected abstract onFocusTrackerBlur(): void; - protected abstract onFindInputFocusTrackerFocus(): void; - protected abstract onFindInputFocusTrackerBlur(): void; + protected abstract _onFocusTrackerFocus(): void; + protected abstract _onFocusTrackerBlur(): void; + protected abstract _onFindInputFocusTrackerFocus(): void; + protected abstract _onFindInputFocusTrackerBlur(): void; protected get inputValue() { return this._findInput.getValue(); diff --git a/src/vs/workbench/contrib/debug/browser/debugQuickAccess.ts b/src/vs/workbench/contrib/debug/browser/debugQuickAccess.ts index 3c920d1366f84..e29b61897e2e5 100644 --- a/src/vs/workbench/contrib/debug/browser/debugQuickAccess.ts +++ b/src/vs/workbench/contrib/debug/browser/debugQuickAccess.ts @@ -33,7 +33,7 @@ export class StartDebugQuickAccessProvider extends PickerQuickAccessProvider { + protected async _getPicks(filter: string): Promise<(IQuickPickSeparator | IPickerQuickAccessItem)[]> { const picks: Array = []; picks.push({ type: 'separator', label: 'launch.json' }); diff --git a/src/vs/workbench/contrib/extensions/browser/extensionsQuickAccess.ts b/src/vs/workbench/contrib/extensions/browser/extensionsQuickAccess.ts index 921231f3f8691..8aecf0ed0c354 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionsQuickAccess.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionsQuickAccess.ts @@ -28,7 +28,7 @@ export class InstallExtensionQuickAccessProvider extends PickerQuickAccessProvid super(InstallExtensionQuickAccessProvider.PREFIX); } - protected getPicks(filter: string, disposables: DisposableStore, token: CancellationToken): Array | Promise> { + protected _getPicks(filter: string, disposables: DisposableStore, token: CancellationToken): Array | Promise> { // Nothing typed if (!filter) { @@ -100,7 +100,7 @@ export class ManageExtensionsQuickAccessProvider extends PickerQuickAccessProvid super(ManageExtensionsQuickAccessProvider.PREFIX); } - protected getPicks(): Array { + protected _getPicks(): Array { return [{ label: localize('manage', "Press Enter to manage your extensions."), accept: () => openExtensionsViewlet(this.viewletService) diff --git a/src/vs/workbench/contrib/quickaccess/browser/viewQuickAccess.ts b/src/vs/workbench/contrib/quickaccess/browser/viewQuickAccess.ts index 4590ddd4cdee0..7facf4844e561 100644 --- a/src/vs/workbench/contrib/quickaccess/browser/viewQuickAccess.ts +++ b/src/vs/workbench/contrib/quickaccess/browser/viewQuickAccess.ts @@ -48,7 +48,7 @@ export class ViewQuickAccessProvider extends PickerQuickAccessProvider { + protected _getPicks(filter: string): Array { const filteredViewEntries = this.doGetViewPickItems().filter(entry => { if (!filter) { return true; diff --git a/src/vs/workbench/contrib/search/browser/anythingQuickAccess.ts b/src/vs/workbench/contrib/search/browser/anythingQuickAccess.ts index fce8acd1d9746..6b923801cb94e 100644 --- a/src/vs/workbench/contrib/search/browser/anythingQuickAccess.ts +++ b/src/vs/workbench/contrib/search/browser/anythingQuickAccess.ts @@ -259,7 +259,7 @@ export class AnythingQuickAccessProvider extends PickerQuickAccessProvider this.clearDecorations(activeEditorControl)); } - protected getPicks(originalFilter: string, disposables: DisposableStore, token: CancellationToken): Picks | Promise> | FastAndSlowPicks | null { + protected _getPicks(originalFilter: string, disposables: DisposableStore, token: CancellationToken): Picks | Promise> | FastAndSlowPicks | null { // Find a suitable range from the pattern looking for ":", "#" or "," // unless we have the `@` editor symbol character inside the filter diff --git a/src/vs/workbench/contrib/search/browser/symbolsQuickAccess.ts b/src/vs/workbench/contrib/search/browser/symbolsQuickAccess.ts index 3c7d555dada32..eaa56c70ef256 100644 --- a/src/vs/workbench/contrib/search/browser/symbolsQuickAccess.ts +++ b/src/vs/workbench/contrib/search/browser/symbolsQuickAccess.ts @@ -83,7 +83,7 @@ export class SymbolsQuickAccessProvider extends PickerQuickAccessProvider> { + protected _getPicks(filter: string, disposables: DisposableStore, token: CancellationToken): Promise> { return this.getSymbolPicks(filter, undefined, token); } diff --git a/src/vs/workbench/contrib/tasks/browser/tasksQuickAccess.ts b/src/vs/workbench/contrib/tasks/browser/tasksQuickAccess.ts index 3b768e712a5b2..f322f2bc68eca 100644 --- a/src/vs/workbench/contrib/tasks/browser/tasksQuickAccess.ts +++ b/src/vs/workbench/contrib/tasks/browser/tasksQuickAccess.ts @@ -39,7 +39,7 @@ export class TasksQuickAccessProvider extends PickerQuickAccessProvider> { + protected async _getPicks(filter: string, disposables: DisposableStore, token: CancellationToken): Promise> { // always await extensions await this.activationPromise; diff --git a/src/vs/workbench/contrib/terminal/browser/links/terminalLinkManager.ts b/src/vs/workbench/contrib/terminal/browser/links/terminalLinkManager.ts index 9f043c2980214..604956bd9b360 100644 --- a/src/vs/workbench/contrib/terminal/browser/links/terminalLinkManager.ts +++ b/src/vs/workbench/contrib/terminal/browser/links/terminalLinkManager.ts @@ -200,7 +200,7 @@ export class TerminalLinkManager extends DisposableStore { if (uri.scheme === Schemas.file) { // Just using fsPath here is unsafe: https://github.com/microsoft/vscode/issues/109076 const fsPath = uri.fsPath; - this._handleLocalLink(((this.osPath.sep === posix.sep) && isWindows) ? fsPath.replace(/\\/g, posix.sep) : fsPath); + this._handleLocalLink(((this._osPath.sep === posix.sep) && isWindows) ? fsPath.replace(/\\/g, posix.sep) : fsPath); return; } @@ -263,7 +263,7 @@ export class TerminalLinkManager extends DisposableStore { return markdown.appendMarkdown(`[${label}](${uri}) (${clickLabel})`); } - private get osPath(): IPath { + private get _osPath(): IPath { if (!this._processManager) { throw new Error('Process manager is required'); } @@ -282,7 +282,7 @@ export class TerminalLinkManager extends DisposableStore { if (!this._processManager.userHome) { return null; } - link = this.osPath.join(this._processManager.userHome, link.substring(1)); + link = this._osPath.join(this._processManager.userHome, link.substring(1)); } else if (link.charAt(0) !== '/' && link.charAt(0) !== '~') { // Resolve workspace path . | .. | -> /. | /.. | / if (this._processManager.os === OperatingSystem.Windows) { @@ -291,7 +291,7 @@ export class TerminalLinkManager extends DisposableStore { // Abort if no workspace is open return null; } - link = this.osPath.join(this._processCwd, link); + link = this._osPath.join(this._processCwd, link); } else { // Remove \\?\ from paths so that they share the same underlying // uri and don't open multiple tabs for the same file @@ -302,10 +302,10 @@ export class TerminalLinkManager extends DisposableStore { // Abort if no workspace is open return null; } - link = this.osPath.join(this._processCwd, link); + link = this._osPath.join(this._processCwd, link); } } - link = this.osPath.normalize(link); + link = this._osPath.normalize(link); return link; } diff --git a/src/vs/workbench/contrib/terminal/browser/terminalActions.ts b/src/vs/workbench/contrib/terminal/browser/terminalActions.ts index 7ad3e3e756c9d..6a41133aa6bd3 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalActions.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalActions.ts @@ -464,11 +464,11 @@ export function registerTerminalActions() { const codeEditorService = accessor.get(ICodeEditorService); const instance = terminalService.getActiveOrCreateInstance(); - let editor = codeEditorService.getActiveCodeEditor(); + const editor = codeEditorService.getActiveCodeEditor(); if (!editor || !editor.hasModel()) { return; } - let selection = editor.getSelection(); + const selection = editor.getSelection(); let text: string; if (selection.isEmpty()) { text = editor.getModel().getLineContent(selection.selectionStartLineNumber).trim(); @@ -836,7 +836,7 @@ export function registerTerminalActions() { const labelService = accessor.get(ILabelService); const remoteAgentService = accessor.get(IRemoteAgentService); const notificationService = accessor.get(INotificationService); - let offProcTerminalService = remoteAgentService.getConnection() ? accessor.get(IRemoteTerminalService) : accessor.get(ILocalTerminalService); + const offProcTerminalService = remoteAgentService.getConnection() ? accessor.get(IRemoteTerminalService) : accessor.get(ILocalTerminalService); const terms = await offProcTerminalService.listProcesses(); diff --git a/src/vs/workbench/contrib/terminal/browser/terminalConfigHelper.ts b/src/vs/workbench/contrib/terminal/browser/terminalConfigHelper.ts index 1b83d10854056..1475c0ee0a5de 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalConfigHelper.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalConfigHelper.ts @@ -43,9 +43,9 @@ export class TerminalConfigHelper implements IBrowserTerminalConfigHelper { @IConfigurationService private readonly _configurationService: IConfigurationService, @IExtensionManagementService private readonly _extensionManagementService: IExtensionManagementService, @INotificationService private readonly _notificationService: INotificationService, - @ITelemetryService private readonly telemetryService: ITelemetryService, - @IInstantiationService private readonly instantiationService: IInstantiationService, - @IProductService private readonly productService: IProductService, + @ITelemetryService private readonly _telemetryService: ITelemetryService, + @IInstantiationService private readonly _instantiationService: IInstantiationService, + @IProductService private readonly _productService: IProductService, ) { this._updateConfig(); this._configurationService.onDidChangeConfiguration(e => { @@ -74,15 +74,15 @@ export class TerminalConfigHelper implements IBrowserTerminalConfigHelper { public configFontIsMonospace(): boolean { const fontSize = 15; const fontFamily = this.config.fontFamily || this._configurationService.getValue('editor').fontFamily || EDITOR_FONT_DEFAULTS.fontFamily; - const i_rect = this._getBoundingRectFor('i', fontFamily, fontSize); - const w_rect = this._getBoundingRectFor('w', fontFamily, fontSize); + const iRect = this._getBoundingRectFor('i', fontFamily, fontSize); + const wRect = this._getBoundingRectFor('w', fontFamily, fontSize); // Check for invalid bounds, there is no reason to believe the font is not monospace - if (!i_rect || !w_rect || !i_rect.width || !w_rect.width) { + if (!iRect || !wRect || !iRect.width || !wRect.width) { return true; } - return i_rect.width === w_rect.width; + return iRect.width === wRect.width; } private _createCharMeasureElementIfNecessary(): HTMLElement { @@ -217,21 +217,21 @@ export class TerminalConfigHelper implements IBrowserTerminalConfigHelper { return r; } - private recommendationsShown = false; + private _recommendationsShown = false; public async showRecommendations(shellLaunchConfig: IShellLaunchConfig): Promise { - if (this.recommendationsShown) { + if (this._recommendationsShown) { return; } - this.recommendationsShown = true; + this._recommendationsShown = true; if (isWindows && shellLaunchConfig.executable && basename(shellLaunchConfig.executable).toLowerCase() === 'wsl.exe') { - const exeBasedExtensionTips = this.productService.exeBasedExtensionTips; + const exeBasedExtensionTips = this._productService.exeBasedExtensionTips; if (!exeBasedExtensionTips || !exeBasedExtensionTips.wsl) { return; } const extId = Object.keys(exeBasedExtensionTips.wsl.recommendations).find(extId => exeBasedExtensionTips.wsl.recommendations[extId].important); - if (extId && ! await this.isExtensionInstalled(extId)) { + if (extId && ! await this._isExtensionInstalled(extId)) { this._notificationService.prompt( Severity.Info, nls.localize( @@ -246,8 +246,8 @@ export class TerminalConfigHelper implements IBrowserTerminalConfigHelper { "extensionId": { "classification": "PublicNonPersonalData", "purpose": "FeatureInsight" } } */ - this.telemetryService.publicLog('terminalLaunchRecommendation:popup', { userReaction: 'install', extId }); - this.instantiationService.createInstance(InstallRecommendedExtensionAction, extId).run(); + this._telemetryService.publicLog('terminalLaunchRecommendation:popup', { userReaction: 'install', extId }); + this._instantiationService.createInstance(InstallRecommendedExtensionAction, extId).run(); } } ], @@ -260,7 +260,7 @@ export class TerminalConfigHelper implements IBrowserTerminalConfigHelper { "userReaction" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } } */ - this.telemetryService.publicLog('terminalLaunchRecommendation:popup', { userReaction: 'cancelled' }); + this._telemetryService.publicLog('terminalLaunchRecommendation:popup', { userReaction: 'cancelled' }); } } ); @@ -268,7 +268,7 @@ export class TerminalConfigHelper implements IBrowserTerminalConfigHelper { } } - private async isExtensionInstalled(id: string): Promise { + private async _isExtensionInstalled(id: string): Promise { const extensions = await this._extensionManagementService.getInstalled(); return extensions.some(e => e.identifier.id === id); } diff --git a/src/vs/workbench/contrib/terminal/browser/terminalFindWidget.ts b/src/vs/workbench/contrib/terminal/browser/terminalFindWidget.ts index 038c3424f808c..52a15285b9408 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalFindWidget.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalFindWidget.ts @@ -47,7 +47,7 @@ export class TerminalFindWidget extends SimpleFindWidget { } } - protected onInputChanged() { + protected _onInputChanged() { // Ignore input changes for now const instance = this._terminalService.getActiveInstance(); if (instance !== null) { @@ -56,7 +56,7 @@ export class TerminalFindWidget extends SimpleFindWidget { return false; } - protected onFocusTrackerFocus() { + protected _onFocusTrackerFocus() { const instance = this._terminalService.getActiveInstance(); if (instance) { instance.notifyFindWidgetFocusChanged(true); @@ -64,7 +64,7 @@ export class TerminalFindWidget extends SimpleFindWidget { this._findWidgetFocused.set(true); } - protected onFocusTrackerBlur() { + protected _onFocusTrackerBlur() { const instance = this._terminalService.getActiveInstance(); if (instance) { instance.notifyFindWidgetFocusChanged(false); @@ -72,11 +72,11 @@ export class TerminalFindWidget extends SimpleFindWidget { this._findWidgetFocused.reset(); } - protected onFindInputFocusTrackerFocus() { + protected _onFindInputFocusTrackerFocus() { this._findInputFocused.set(true); } - protected onFindInputFocusTrackerBlur() { + protected _onFindInputFocusTrackerBlur() { this._findInputFocused.reset(); } diff --git a/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.ts b/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.ts index c26b9b97f2336..e5dae8ec91b00 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.ts @@ -448,7 +448,7 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce } else { // For normal terminals write a message indicating what happened and relaunch // using the previous shellLaunchConfig - let message = localize('ptyHostRelaunch', "Restarting the terminal because the connection to the shell process was lost..."); + const message = localize('ptyHostRelaunch', "Restarting the terminal because the connection to the shell process was lost..."); this._onProcessData.fire({ data: formatMessageForTerminal(message), trackCommit: false }); await this.relaunch(this._shellLaunchConfig, this._dimensions.cols, this._dimensions.rows, this._isScreenReaderModeEnabled, false); } diff --git a/src/vs/workbench/contrib/terminal/browser/terminalQuickAccess.ts b/src/vs/workbench/contrib/terminal/browser/terminalQuickAccess.ts index d5c6644c2e536..137d1450be44f 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalQuickAccess.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalQuickAccess.ts @@ -18,16 +18,16 @@ export class TerminalQuickAccessProvider extends PickerQuickAccessProvider { + protected _getPicks(filter: string): Array { const terminalPicks: Array = []; - const terminalTabs = this.terminalService.terminalTabs; + const terminalTabs = this._terminalService.terminalTabs; for (let tabIndex = 0; tabIndex < terminalTabs.length; tabIndex++) { const terminalTab = terminalTabs[tabIndex]; for (let terminalIndex = 0; terminalIndex < terminalTab.terminalInstances.length; terminalIndex++) { @@ -52,7 +52,7 @@ export class TerminalQuickAccessProvider extends PickerQuickAccessProvider { switch (buttonIndex) { case 0: - this.commandService.executeCommand(TERMINAL_COMMAND_ID.RENAME, terminal); + this._commandService.executeCommand(TERMINAL_COMMAND_ID.RENAME, terminal); return TriggerAction.NO_ACTION; case 1: terminal.dispose(true); @@ -62,8 +62,8 @@ export class TerminalQuickAccessProvider extends PickerQuickAccessProvider { - this.terminalService.setActiveInstance(terminal); - this.terminalService.showPanel(!event.inBackground); + this._terminalService.setActiveInstance(terminal); + this._terminalService.showPanel(!event.inBackground); } }); } @@ -78,13 +78,13 @@ export class TerminalQuickAccessProvider extends PickerQuickAccessProvider this.commandService.executeCommand(TERMINAL_COMMAND_ID.NEW) + accept: () => this._commandService.executeCommand(TERMINAL_COMMAND_ID.NEW) }); const createWithProfileLabel = localize("workbench.action.terminal.newWithProfilePlus", "Create New Terminal With Profile"); terminalPicks.push({ label: `$(plus) ${createWithProfileLabel}`, ariaLabel: createWithProfileLabel, - accept: () => this.commandService.executeCommand(TERMINAL_COMMAND_ID.NEW_WITH_PROFILE) + accept: () => this._commandService.executeCommand(TERMINAL_COMMAND_ID.NEW_WITH_PROFILE) }); return terminalPicks; diff --git a/src/vs/workbench/contrib/terminal/browser/widgets/environmentVariableInfoWidget.ts b/src/vs/workbench/contrib/terminal/browser/widgets/environmentVariableInfoWidget.ts index f843f08e0ad83..af556051eee49 100644 --- a/src/vs/workbench/contrib/terminal/browser/widgets/environmentVariableInfoWidget.ts +++ b/src/vs/workbench/contrib/terminal/browser/widgets/environmentVariableInfoWidget.ts @@ -43,7 +43,7 @@ export class EnvironmentVariableInfoWidget extends Widget implements ITerminalWi const scheduler: RunOnceScheduler = new RunOnceScheduler(() => this._showHover(), this._configurationService.getValue('workbench.hover.delay')); this._register(scheduler); - let origin = { x: 0, y: 0 }; + const origin = { x: 0, y: 0 }; this.onmouseover(this._domNode, e => { origin.x = e.browserEvent.pageX; diff --git a/src/vs/workbench/contrib/terminal/test/browser/terminalTypeahead.test.ts b/src/vs/workbench/contrib/terminal/test/browser/terminalTypeahead.test.ts index 184af066d14bd..699338d292eca 100644 --- a/src/vs/workbench/contrib/terminal/test/browser/terminalTypeahead.test.ts +++ b/src/vs/workbench/contrib/terminal/test/browser/terminalTypeahead.test.ts @@ -389,35 +389,35 @@ suite('Workbench - Terminal Typeahead', () => { class TestTypeAheadAddon extends TypeAheadAddon { public unlockMakingPredictions() { - this.lastRow = { y: 1, startingX: 100, endingX: 100, charState: CharPredictState.Validated }; + this._lastRow = { y: 1, startingX: 100, endingX: 100, charState: CharPredictState.Validated }; } public lockMakingPredictions() { - this.lastRow = undefined; + this._lastRow = undefined; } public unlockNavigating() { - this.lastRow = { y: 1, startingX: 1, endingX: 1, charState: CharPredictState.Validated }; + this._lastRow = { y: 1, startingX: 1, endingX: 1, charState: CharPredictState.Validated }; } public reevaluateNow() { - this.reevaluatePredictorStateNow(this.stats!, this.timeline!); + this._reevaluatePredictorStateNow(this.stats!, this._timeline!); } public get isShowing() { - return !!this.timeline?.isShowingPredictions; + return !!this._timeline?.isShowingPredictions; } public undoAllPredictions() { - this.timeline?.undoAllPredictions(); + this._timeline?.undoAllPredictions(); } public physicalCursor(buffer: IBuffer) { - return this.timeline?.physicalCursor(buffer); + return this._timeline?.physicalCursor(buffer); } public tentativeCursor(buffer: IBuffer) { - return this.timeline?.tentativeCursor(buffer); + return this._timeline?.tentativeCursor(buffer); } } diff --git a/src/vs/workbench/contrib/webview/browser/webviewFindWidget.ts b/src/vs/workbench/contrib/webview/browser/webviewFindWidget.ts index 109d1e547cedb..90bb06bb65949 100644 --- a/src/vs/workbench/contrib/webview/browser/webviewFindWidget.ts +++ b/src/vs/workbench/contrib/webview/browser/webviewFindWidget.ts @@ -46,7 +46,7 @@ export class WebviewFindWidget extends SimpleFindWidget { this._delegate.focus(); } - public onInputChanged() { + public _onInputChanged() { const val = this.inputValue; if (val) { this._delegate.startFind(val); @@ -56,17 +56,17 @@ export class WebviewFindWidget extends SimpleFindWidget { return false; } - protected onFocusTrackerFocus() { + protected _onFocusTrackerFocus() { this._findWidgetFocused.set(true); } - protected onFocusTrackerBlur() { + protected _onFocusTrackerBlur() { this._findWidgetFocused.reset(); } - protected onFindInputFocusTrackerFocus() { } + protected _onFindInputFocusTrackerFocus() { } - protected onFindInputFocusTrackerBlur() { } + protected _onFindInputFocusTrackerBlur() { } protected findFirst() { } } diff --git a/src/vs/workbench/test/browser/quickAccess.test.ts b/src/vs/workbench/test/browser/quickAccess.test.ts index 9259c00c46225..3eff27aeda00b 100644 --- a/src/vs/workbench/test/browser/quickAccess.test.ts +++ b/src/vs/workbench/test/browser/quickAccess.test.ts @@ -207,7 +207,7 @@ suite('QuickAccess', () => { super('fast'); } - protected getPicks(filter: string, disposables: DisposableStore, token: CancellationToken): Array { + protected _getPicks(filter: string, disposables: DisposableStore, token: CancellationToken): Array { fastProviderCalled = true; return [{ label: 'Fast Pick' }]; @@ -220,7 +220,7 @@ suite('QuickAccess', () => { super('slow'); } - protected async getPicks(filter: string, disposables: DisposableStore, token: CancellationToken): Promise> { + protected async _getPicks(filter: string, disposables: DisposableStore, token: CancellationToken): Promise> { slowProviderCalled = true; await timeout(1); @@ -239,7 +239,7 @@ suite('QuickAccess', () => { super('bothFastAndSlow'); } - protected getPicks(filter: string, disposables: DisposableStore, token: CancellationToken): FastAndSlowPicks { + protected _getPicks(filter: string, disposables: DisposableStore, token: CancellationToken): FastAndSlowPicks { fastAndSlowProviderCalled = true; return { From 81734d23502eff9bab2cbb178eeaec3aa33d1f3a Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 4 May 2021 05:39:27 -0700 Subject: [PATCH 3/5] Change casing of terminal command id enum --- .../browser/environmentVariableInfo.ts | 2 +- .../terminal/browser/terminal.contribution.ts | 4 +- .../browser/terminal.web.contribution.ts | 2 +- .../terminal/browser/terminalActions.ts | 134 +++++----- .../contrib/terminal/browser/terminalMenus.ts | 54 ++-- .../terminal/browser/terminalQuickAccess.ts | 6 +- .../terminal/browser/terminalTabsWidget.ts | 4 +- .../contrib/terminal/browser/terminalView.ts | 12 +- .../contrib/terminal/common/terminal.ts | 250 +++++++++--------- .../electron-sandbox/terminalRemote.ts | 2 +- .../browser/links/terminalLinkHelpers.test.ts | 6 +- .../contrib/watermark/browser/watermark.ts | 2 +- 12 files changed, 239 insertions(+), 239 deletions(-) diff --git a/src/vs/workbench/contrib/terminal/browser/environmentVariableInfo.ts b/src/vs/workbench/contrib/terminal/browser/environmentVariableInfo.ts index ed9ea1f02d179..456ab8e244ab1 100644 --- a/src/vs/workbench/contrib/terminal/browser/environmentVariableInfo.ts +++ b/src/vs/workbench/contrib/terminal/browser/environmentVariableInfo.ts @@ -64,7 +64,7 @@ export class EnvironmentVariableInfoStale implements IEnvironmentVariableInfo { return [{ label: localize('relaunchTerminalLabel', "Relaunch terminal"), run: () => this._terminalService.getInstanceFromId(this._terminalId)?.relaunch(), - commandId: TERMINAL_COMMAND_ID.RELAUNCH + commandId: TERMINAL_COMMAND_ID.Relaunch }]; } } diff --git a/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts b/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts index cf42d9a7c6d0e..ff2b18bd942de 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts @@ -82,7 +82,7 @@ Registry.as(ViewContainerExtensions.ViewsRegistry).registerViews canMoveView: true, ctorDescriptor: new SyncDescriptor(TerminalViewPane), openCommandActionDescriptor: { - id: TERMINAL_COMMAND_ID.TOGGLE, + id: TERMINAL_COMMAND_ID.Toggle, mnemonicTitle: nls.localize({ key: 'miToggleIntegratedTerminal', comment: ['&& denotes a mnemonic'] }, "&&Terminal"), keybindings: { primary: KeyMod.CtrlCmd | KeyCode.US_BACKTICK, @@ -97,7 +97,7 @@ registerTerminalActions(); function registerSendSequenceKeybinding(text: string, rule: { when?: ContextKeyExpression } & IKeybindings): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ - id: TERMINAL_COMMAND_ID.SEND_SEQUENCE, + id: TERMINAL_COMMAND_ID.SendSequence, weight: KeybindingWeight.WorkbenchContrib, when: rule.when || KEYBINDING_CONTEXT_TERMINAL_FOCUS, primary: rule.primary, diff --git a/src/vs/workbench/contrib/terminal/browser/terminal.web.contribution.ts b/src/vs/workbench/contrib/terminal/browser/terminal.web.contribution.ts index 43ce70c887f50..0c249d92fc428 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminal.web.contribution.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminal.web.contribution.ts @@ -14,7 +14,7 @@ registerSingleton(ITerminalProfileResolverService, BrowserTerminalProfileResolve // Register standard external terminal keybinding as integrated terminal when in web as the // external terminal is not available KeybindingsRegistry.registerKeybindingRule({ - id: TERMINAL_COMMAND_ID.NEW, + id: TERMINAL_COMMAND_ID.New, weight: KeybindingWeight.WorkbenchContrib, when: undefined, primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_C diff --git a/src/vs/workbench/contrib/terminal/browser/terminalActions.ts b/src/vs/workbench/contrib/terminal/browser/terminalActions.ts index 6a41133aa6bd3..82148c53dc733 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalActions.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalActions.ts @@ -105,7 +105,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.NEW_IN_ACTIVE_WORKSPACE, + id: TERMINAL_COMMAND_ID.NewInActiveWorkspace, title: { value: localize('workbench.action.terminal.newInActiveWorkspace', "Create New Integrated Terminal (In Active Workspace)"), original: 'Create New Integrated Terminal (In Active Workspace)' }, f1: true, category @@ -126,7 +126,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.NEW_WITH_PROFILE, + id: TERMINAL_COMMAND_ID.NewWithProfile, title: { value: localize('workbench.action.terminal.newWithProfile', "Create New Integrated Terminal (With Profile)"), original: 'Create New Integrated Terminal (With Profile)' }, f1: true, category, @@ -195,7 +195,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.SHOW_TABS, + id: TERMINAL_COMMAND_ID.ShowTabs, title: { value: localize('workbench.action.terminal.showTabs', "Show Tabs"), original: 'Show Tabs' }, f1: false, category, @@ -211,7 +211,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.FOCUS_PREVIOUS_PANE, + id: TERMINAL_COMMAND_ID.FocusPreviousPane, title: { value: localize('workbench.action.terminal.focusPreviousPane', "Focus Previous Pane"), original: 'Focus Previous Pane' }, f1: true, category, @@ -237,7 +237,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.FOCUS_NEXT_PANE, + id: TERMINAL_COMMAND_ID.FocusNextPane, title: { value: localize('workbench.action.terminal.focusNextPane', "Focus Next Pane"), original: 'Focus Next Pane' }, f1: true, category, @@ -263,7 +263,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.RESIZE_PANE_LEFT, + id: TERMINAL_COMMAND_ID.ResizePaneLeft, title: { value: localize('workbench.action.terminal.resizePaneLeft', "Resize Pane Left"), original: 'Resize Pane Left' }, f1: true, category, @@ -283,7 +283,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.RESIZE_PANE_RIGHT, + id: TERMINAL_COMMAND_ID.ResizePaneRight, title: { value: localize('workbench.action.terminal.resizePaneRight', "Resize Pane Right"), original: 'Resize Pane Right' }, f1: true, category, @@ -303,7 +303,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.RESIZE_PANE_UP, + id: TERMINAL_COMMAND_ID.ResizePaneUp, title: { value: localize('workbench.action.terminal.resizePaneUp', "Resize Pane Up"), original: 'Resize Pane Up' }, f1: true, category, @@ -322,7 +322,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.RESIZE_PANE_DOWN, + id: TERMINAL_COMMAND_ID.ResizePaneDown, title: { value: localize('workbench.action.terminal.resizePaneDown', "Resize Pane Down"), original: 'Resize Pane Down' }, f1: true, category, @@ -341,7 +341,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.FOCUS, + id: TERMINAL_COMMAND_ID.Focus, title: { value: localize('workbench.action.terminal.focus', "Focus Terminal"), original: 'Focus Terminal' }, f1: true, category, @@ -385,7 +385,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.FOCUS_TABS, + id: TERMINAL_COMMAND_ID.FocusTabs, title: { value: localize('workbench.action.terminal.focus.tabsView', "Focus Terminal Tabs View"), original: 'Focus Terminal Tabs View' }, f1: true, category, @@ -404,7 +404,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.FOCUS_NEXT, + id: TERMINAL_COMMAND_ID.FocusNext, title: { value: localize('workbench.action.terminal.focusNext', "Focus Next Terminal"), original: 'Focus Next Terminal' }, f1: true, category, @@ -428,7 +428,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.FOCUS_PREVIOUS, + id: TERMINAL_COMMAND_ID.FocusPrevious, title: { value: localize('workbench.action.terminal.focusPrevious', "Focus Previous Terminal"), original: 'Focus Previous Terminal' }, f1: true, category, @@ -452,7 +452,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.RUN_SELECTED_TEXT, + id: TERMINAL_COMMAND_ID.RunSelectedText, title: { value: localize('workbench.action.terminal.runSelectedText', "Run Selected Text In Active Terminal"), original: 'Run Selected Text In Active Terminal' }, f1: true, category, @@ -483,7 +483,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.RUN_ACTIVE_FILE, + id: TERMINAL_COMMAND_ID.RunActiveFile, title: { value: localize('workbench.action.terminal.runActiveFile', "Run Active File In Active Terminal"), original: 'Run Active File In Active Terminal' }, f1: true, category, @@ -516,7 +516,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.SCROLL_DOWN_LINE, + id: TERMINAL_COMMAND_ID.ScrollDownLine, title: { value: localize('workbench.action.terminal.scrollDown', "Scroll Down (Line)"), original: 'Scroll Down (Line)' }, f1: true, category, @@ -536,7 +536,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.SCROLL_DOWN_PAGE, + id: TERMINAL_COMMAND_ID.ScrollDownPage, title: { value: localize('workbench.action.terminal.scrollDownPage', "Scroll Down (Page)"), original: 'Scroll Down (Page)' }, f1: true, category, @@ -556,7 +556,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.SCROLL_TO_BOTTOM, + id: TERMINAL_COMMAND_ID.ScrollToBottom, title: { value: localize('workbench.action.terminal.scrollToBottom', "Scroll to Bottom"), original: 'Scroll to Bottom' }, f1: true, category, @@ -576,7 +576,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.SCROLL_UP_LINE, + id: TERMINAL_COMMAND_ID.ScrollUpLine, title: { value: localize('workbench.action.terminal.scrollUp', "Scroll Up (Line)"), original: 'Scroll Up (Line)' }, f1: true, category, @@ -596,7 +596,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.SCROLL_UP_PAGE, + id: TERMINAL_COMMAND_ID.ScrollUpPage, title: { value: localize('workbench.action.terminal.scrollUpPage', "Scroll Up (Page)"), original: 'Scroll Up (Page)' }, f1: true, category, @@ -616,7 +616,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.SCROLL_TO_TOP, + id: TERMINAL_COMMAND_ID.ScrollToTop, title: { value: localize('workbench.action.terminal.scrollToTop', "Scroll to Top"), original: 'Scroll to Top' }, f1: true, category, @@ -636,7 +636,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.NAVIGATION_MODE_EXIT, + id: TERMINAL_COMMAND_ID.NavigationModeExit, title: { value: localize('workbench.action.terminal.navigationModeExit', "Exit Navigation Mode"), original: 'Exit Navigation Mode' }, f1: true, category, @@ -655,7 +655,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.NAVIGATION_MODE_FOCUS_PREVIOUS, + id: TERMINAL_COMMAND_ID.NavigationModeFocusPrevious, title: { value: localize('workbench.action.terminal.navigationModeFocusPrevious', "Focus Previous Line (Navigation Mode)"), original: 'Focus Previous Line (Navigation Mode)' }, f1: true, category, @@ -677,7 +677,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.NAVIGATION_MODE_FOCUS_NEXT, + id: TERMINAL_COMMAND_ID.NavigationModeFocusNext, title: { value: localize('workbench.action.terminal.navigationModeFocusNext', "Focus Next Line (Navigation Mode)"), original: 'Focus Next Line (Navigation Mode)' }, f1: true, category, @@ -699,7 +699,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.CLEAR_SELECTION, + id: TERMINAL_COMMAND_ID.ClearSelection, title: { value: localize('workbench.action.terminal.clearSelection', "Clear Selection"), original: 'Clear Selection' }, f1: true, category, @@ -721,7 +721,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.CHANGE_ICON, + id: TERMINAL_COMMAND_ID.ChangeIcon, title: { value: localize('workbench.action.terminal.changeIcon', "Change Icon..."), original: 'Change Icon...' }, f1: true, category, @@ -735,7 +735,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.CHANGE_ICON_INSTANCE, + id: TERMINAL_COMMAND_ID.ChangeIconInstance, title: { value: localize('workbench.action.terminal.changeIcon', "Change Icon..."), original: 'Change Icon...' }, f1: false, category, @@ -749,7 +749,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.RENAME, + id: TERMINAL_COMMAND_ID.Rename, title: { value: localize('workbench.action.terminal.rename', "Rename..."), original: 'Rename...' }, f1: true, category, @@ -763,7 +763,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.RENAME_INSTANCE, + id: TERMINAL_COMMAND_ID.RenameInstance, title: { value: localize('workbench.action.terminal.renameInstance', "Rename..."), original: 'Rename...' }, f1: false, category, @@ -785,7 +785,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.FIND_FOCUS, + id: TERMINAL_COMMAND_ID.FindFocus, title: { value: localize('workbench.action.terminal.focusFind', "Focus Find"), original: 'Focus Find' }, f1: true, category, @@ -804,7 +804,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.FIND_HIDE, + id: TERMINAL_COMMAND_ID.FindHide, title: { value: localize('workbench.action.terminal.hideFind', "Hide Find"), original: 'Hide Find' }, f1: true, category, @@ -824,7 +824,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.ATTACH_TO_REMOTE_TERMINAL, + id: TERMINAL_COMMAND_ID.AttachToRemoteTerminal, title: { value: localize('workbench.action.terminal.attachToRemote', "Attach to Session"), original: 'Attach to Session' }, f1: true, category @@ -867,7 +867,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.QUICK_OPEN_TERM, + id: TERMINAL_COMMAND_ID.QuickOpenTerm, title: { value: localize('quickAccessTerminal', "Switch Active Terminal"), original: 'Switch Active Terminal' }, f1: true, category, @@ -881,7 +881,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.SCROLL_TO_PREVIOUS_COMMAND, + id: TERMINAL_COMMAND_ID.ScrollToPreviousCommand, title: { value: localize('workbench.action.terminal.scrollToPreviousCommand', "Scroll To Previous Command"), original: 'Scroll To Previous Command' }, f1: true, category, @@ -903,7 +903,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.SCROLL_TO_NEXT_COMMAND, + id: TERMINAL_COMMAND_ID.ScrollToNextCommand, title: { value: localize('workbench.action.terminal.scrollToNextCommand', "Scroll To Next Command"), original: 'Scroll To Next Command' }, f1: true, category, @@ -925,7 +925,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.SELECT_TO_PREVIOUS_COMMAND, + id: TERMINAL_COMMAND_ID.SelectToPreviousCommand, title: { value: localize('workbench.action.terminal.selectToPreviousCommand', "Select To Previous Command"), original: 'Select To Previous Command' }, f1: true, category, @@ -947,7 +947,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.SELECT_TO_NEXT_COMMAND, + id: TERMINAL_COMMAND_ID.SelectToNextCommand, title: { value: localize('workbench.action.terminal.selectToNextCommand', "Select To Next Command"), original: 'Select To Next Command' }, f1: true, category, @@ -969,7 +969,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.SELECT_TO_PREVIOUS_LINE, + id: TERMINAL_COMMAND_ID.SelectToPreviousLine, title: { value: localize('workbench.action.terminal.selectToPreviousLine', "Select To Previous Line"), original: 'Select To Previous Line' }, f1: true, category, @@ -986,7 +986,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.SELECT_TO_NEXT_LINE, + id: TERMINAL_COMMAND_ID.SelectToNextLine, title: { value: localize('workbench.action.terminal.selectToNextLine', "Select To Next Line"), original: 'Select To Next Line' }, f1: true, category, @@ -1003,7 +1003,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.TOGGLE_ESCAPE_SEQUENCE_LOGGING, + id: TERMINAL_COMMAND_ID.ToggleEscapeSequenceLogging, title: { value: localize('workbench.action.terminal.toggleEscapeSequenceLogging', "Toggle Escape Sequence Logging"), original: 'Toggle Escape Sequence Logging' }, f1: true, category, @@ -1018,7 +1018,7 @@ export function registerTerminalActions() { constructor() { const title = localize('workbench.action.terminal.sendSequence', "Send Custom Sequence To Terminal"); super({ - id: TERMINAL_COMMAND_ID.SEND_SEQUENCE, + id: TERMINAL_COMMAND_ID.SendSequence, title: { value: title, original: 'Send Custom Sequence To Terminal' }, category, description: { @@ -1045,7 +1045,7 @@ export function registerTerminalActions() { constructor() { const title = localize('workbench.action.terminal.newWithCwd', "Create New Integrated Terminal Starting in a Custom Working Directory"); super({ - id: TERMINAL_COMMAND_ID.NEW_WITH_CWD, + id: TERMINAL_COMMAND_ID.NewWithCwd, title: { value: title, original: 'Create New Integrated Terminal Starting in a Custom Working Directory' }, category, description: { @@ -1083,7 +1083,7 @@ export function registerTerminalActions() { constructor() { const title = localize('workbench.action.terminal.renameWithArg', "Rename the Currently Active Terminal"); super({ - id: TERMINAL_COMMAND_ID.RENAME_WITH_ARG, + id: TERMINAL_COMMAND_ID.RenameWithArgs, title: { value: title, original: 'Rename the Currently Active Terminal' }, category, description: { @@ -1118,7 +1118,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.TOGGLE_FIND_REGEX, + id: TERMINAL_COMMAND_ID.ToggleFindRegex, title: { value: localize('workbench.action.terminal.toggleFindRegex', "Toggle Find Using Regex"), original: 'Toggle Find Using Regex' }, f1: true, category, @@ -1139,7 +1139,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.TOGGLE_FIND_WHOLE_WORD, + id: TERMINAL_COMMAND_ID.ToggleFindWholeWord, title: { value: localize('workbench.action.terminal.toggleFindWholeWord', "Toggle Find Using Whole Word"), original: 'Toggle Find Using Whole Word' }, f1: true, category, @@ -1160,7 +1160,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.TOGGLE_FIND_CASE_SENSITIVE, + id: TERMINAL_COMMAND_ID.ToggleFindCaseSensitive, title: { value: localize('workbench.action.terminal.toggleFindCaseSensitive', "Toggle Find Using Case Sensitive"), original: 'Toggle Find Using Case Sensitive' }, f1: true, category, @@ -1181,7 +1181,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.FIND_NEXT, + id: TERMINAL_COMMAND_ID.FindNext, title: { value: localize('workbench.action.terminal.findNext', "Find Next"), original: 'Find Next' }, f1: true, category, @@ -1208,7 +1208,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.FIND_PREVIOUS, + id: TERMINAL_COMMAND_ID.FindPrevious, title: { value: localize('workbench.action.terminal.findPrevious', "Find Previous"), original: 'Find Previous' }, f1: true, category, @@ -1235,7 +1235,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.SEARCH_WORKSPACE, + id: TERMINAL_COMMAND_ID.SearchWorkspace, title: { value: localize('workbench.action.terminal.searchWorkspace', "Search Workspace"), original: 'Search Workspace' }, f1: true, category, @@ -1257,7 +1257,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.RELAUNCH, + id: TERMINAL_COMMAND_ID.Relaunch, title: { value: localize('workbench.action.terminal.relaunch', "Relaunch Active Terminal"), original: 'Relaunch Active Terminal' }, f1: true, category, @@ -1271,7 +1271,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.SHOW_ENVIRONMENT_INFORMATION, + id: TERMINAL_COMMAND_ID.ShowEnvironmentInformation, title: { value: localize('workbench.action.terminal.showEnvironmentInformation', "Show Environment Information"), original: 'Show Environment Information' }, f1: true, category, @@ -1285,7 +1285,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.SPLIT, + id: TERMINAL_COMMAND_ID.Split, title: { value: localize('workbench.action.terminal.split', "Split Terminal"), original: 'Split Terminal' }, f1: true, category, @@ -1326,7 +1326,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.SPLIT_INSTANCE, + id: TERMINAL_COMMAND_ID.SplitInstance, title: { value: localize('workbench.action.terminal.split', "Split Terminal"), original: 'Split Terminal' }, f1: false, category, @@ -1356,7 +1356,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.SPLIT_IN_ACTIVE_WORKSPACE, + id: TERMINAL_COMMAND_ID.SplitInActiveWorkspace, title: { value: localize('workbench.action.terminal.splitInActiveWorkspace', "Split Terminal (In Active Workspace)"), original: 'Split Terminal (In Active Workspace)' }, f1: true, category, @@ -1375,7 +1375,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.SELECT_ALL, + id: TERMINAL_COMMAND_ID.SelectAll, title: { value: localize('workbench.action.terminal.selectAll', "Select All"), original: 'Select All' }, f1: true, category, @@ -1400,7 +1400,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.NEW, + id: TERMINAL_COMMAND_ID.New, title: { value: localize('workbench.action.terminal.new', "Create New Integrated Terminal"), original: 'Create New Integrated Terminal' }, f1: true, category, @@ -1452,7 +1452,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.KILL, + id: TERMINAL_COMMAND_ID.Kill, title: { value: localize('workbench.action.terminal.kill', "Kill the Active Terminal Instance"), original: 'Kill the Active Terminal Instance' }, f1: true, category, @@ -1483,7 +1483,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.KILL_INSTANCE, + id: TERMINAL_COMMAND_ID.KillInstance, title: { value: localize('workbench.action.terminal.kill.short', "Kill Terminal"), original: 'Kill Terminal' }, @@ -1513,7 +1513,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.CLEAR, + id: TERMINAL_COMMAND_ID.Clear, title: { value: localize('workbench.action.terminal.clear', "Clear"), original: 'Clear' }, f1: true, category, @@ -1538,7 +1538,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.SELECT_DEFAULT_PROFILE, + id: TERMINAL_COMMAND_ID.SelectDefaultProfile, title: { value: localize('workbench.action.terminal.selectDefaultProfile', "Select Default Profile"), original: 'Select Default Profile' }, f1: true, category, @@ -1553,8 +1553,8 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.CREATE_WITH_PROFILE_BUTTON, - title: TERMINAL_COMMAND_ID.CREATE_WITH_PROFILE_BUTTON, + id: TERMINAL_COMMAND_ID.CreateWithProfileButton, + title: TERMINAL_COMMAND_ID.CreateWithProfileButton, f1: false, category, precondition: KEYBINDING_CONTEXT_TERMINAL_PROCESS_SUPPORTED, @@ -1575,7 +1575,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.CONFIGURE_TERMINAL_SETTINGS, + id: TERMINAL_COMMAND_ID.ConfigureTerminalSettings, title: { value: localize('workbench.action.terminal.openSettings', "Configure Terminal Settings"), original: 'Configure Terminal Settings' }, f1: true, category, @@ -1592,7 +1592,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.COPY_SELECTION, + id: TERMINAL_COMMAND_ID.CopySelection, title: { value: localize('workbench.action.terminal.copySelection', "Copy Selection"), original: 'Copy Selection' }, f1: true, category, @@ -1617,7 +1617,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.PASTE, + id: TERMINAL_COMMAND_ID.Paste, title: { value: localize('workbench.action.terminal.paste', "Paste into Active Terminal"), original: 'Paste into Active Terminal' }, f1: true, category, @@ -1641,7 +1641,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.PASTE_SELECTION, + id: TERMINAL_COMMAND_ID.PasteSelection, title: { value: localize('workbench.action.terminal.pasteSelection', "Paste Selection into Active Terminal"), original: 'Paste Selection into Active Terminal' }, f1: true, category, @@ -1663,7 +1663,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.SWITCH_TERMINAL, + id: TERMINAL_COMMAND_ID.SwitchTerminal, title: switchTerminalTitle, f1: true, category, diff --git a/src/vs/workbench/contrib/terminal/browser/terminalMenus.ts b/src/vs/workbench/contrib/terminal/browser/terminalMenus.ts index 0242b6591e96d..cb0911e44547b 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalMenus.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalMenus.ts @@ -36,7 +36,7 @@ export function setupTerminalMenus(): void { id: MenuId.MenubarTerminalMenu, item: { group: TerminalMenuBarGroup.Create, command: { - id: TERMINAL_COMMAND_ID.NEW, + id: TERMINAL_COMMAND_ID.New, title: localize({ key: 'miNewTerminal', comment: ['&& denotes a mnemonic'] }, "&&New Terminal") }, order: 1 @@ -46,7 +46,7 @@ export function setupTerminalMenus(): void { id: MenuId.MenubarTerminalMenu, item: { group: TerminalMenuBarGroup.Create, command: { - id: TERMINAL_COMMAND_ID.SPLIT, + id: TERMINAL_COMMAND_ID.Split, title: localize({ key: 'miSplitTerminal', comment: ['&& denotes a mnemonic'] }, "&&Split Terminal"), precondition: ContextKeyExpr.has('terminalIsOpen') }, @@ -58,7 +58,7 @@ export function setupTerminalMenus(): void { id: MenuId.MenubarTerminalMenu, item: { group: TerminalMenuBarGroup.Run, command: { - id: TERMINAL_COMMAND_ID.RUN_ACTIVE_FILE, + id: TERMINAL_COMMAND_ID.RunActiveFile, title: localize({ key: 'miRunActiveFile', comment: ['&& denotes a mnemonic'] }, "Run &&Active File") }, order: 3, @@ -69,7 +69,7 @@ export function setupTerminalMenus(): void { id: MenuId.MenubarTerminalMenu, item: { group: TerminalMenuBarGroup.Run, command: { - id: TERMINAL_COMMAND_ID.RUN_SELECTED_TEXT, + id: TERMINAL_COMMAND_ID.RunSelectedText, title: localize({ key: 'miRunSelectedText', comment: ['&& denotes a mnemonic'] }, "Run &&Selected Text") }, order: 4, @@ -85,7 +85,7 @@ export function setupTerminalMenus(): void { id: MenuId.TerminalInstanceContext, item: { group: ContextMenuGroup.Create, command: { - id: TERMINAL_COMMAND_ID.SPLIT, + id: TERMINAL_COMMAND_ID.Split, title: localize('workbench.action.terminal.split', "Split Terminal") } } @@ -93,7 +93,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalInstanceContext, item: { command: { - id: TERMINAL_COMMAND_ID.NEW, + id: TERMINAL_COMMAND_ID.New, title: localize('workbench.action.terminal.new.short', "New Terminal") }, group: ContextMenuGroup.Create @@ -102,7 +102,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalInstanceContext, item: { command: { - id: TERMINAL_COMMAND_ID.KILL, + id: TERMINAL_COMMAND_ID.Kill, title: localize('workbench.action.terminal.kill.short', "Kill Terminal") }, group: ContextMenuGroup.Kill @@ -111,7 +111,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalInstanceContext, item: { command: { - id: TERMINAL_COMMAND_ID.COPY_SELECTION, + id: TERMINAL_COMMAND_ID.CopySelection, title: localize('workbench.action.terminal.copySelection.short', "Copy") }, group: ContextMenuGroup.Edit, @@ -121,7 +121,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalInstanceContext, item: { command: { - id: TERMINAL_COMMAND_ID.PASTE, + id: TERMINAL_COMMAND_ID.Paste, title: localize('workbench.action.terminal.paste.short', "Paste") }, group: ContextMenuGroup.Edit, @@ -131,7 +131,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalInstanceContext, item: { command: { - id: TERMINAL_COMMAND_ID.CLEAR, + id: TERMINAL_COMMAND_ID.Clear, title: localize('workbench.action.terminal.clear', "Clear") }, group: ContextMenuGroup.Clear, @@ -140,7 +140,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalInstanceContext, item: { command: { - id: TERMINAL_COMMAND_ID.SHOW_TABS, + id: TERMINAL_COMMAND_ID.ShowTabs, title: localize('workbench.action.terminal.showsTabs', "Show Tabs") }, when: ContextKeyExpr.not(`config.${TERMINAL_SETTING_ID.TabsEnabled}`), @@ -150,7 +150,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalInstanceContext, item: { command: { - id: TERMINAL_COMMAND_ID.SELECT_ALL, + id: TERMINAL_COMMAND_ID.SelectAll, title: localize('workbench.action.terminal.selectAll', "Select All"), }, group: ContextMenuGroup.Edit, @@ -165,7 +165,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalTabEmptyAreaContext, item: { command: { - id: TERMINAL_COMMAND_ID.NEW_WITH_PROFILE, + id: TERMINAL_COMMAND_ID.NewWithProfile, title: localize('workbench.action.terminal.newWithProfile.short', "New Terminal With Profile") }, group: ContextMenuGroup.Create @@ -174,7 +174,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalTabEmptyAreaContext, item: { command: { - id: TERMINAL_COMMAND_ID.NEW, + id: TERMINAL_COMMAND_ID.New, title: localize('workbench.action.terminal.new.short', "New Terminal") }, group: ContextMenuGroup.Create @@ -188,7 +188,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalNewDropdownContext, item: { command: { - id: TERMINAL_COMMAND_ID.SELECT_DEFAULT_PROFILE, + id: TERMINAL_COMMAND_ID.SelectDefaultProfile, title: { value: localize('workbench.action.terminal.selectDefaultProfile', "Select Default Profile"), original: 'Select Default Profile' } }, group: TerminalTabContextMenuGroup.Configure @@ -197,7 +197,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalNewDropdownContext, item: { command: { - id: TERMINAL_COMMAND_ID.CONFIGURE_TERMINAL_SETTINGS, + id: TERMINAL_COMMAND_ID.ConfigureTerminalSettings, title: localize('workbench.action.terminal.openSettings', "Configure Terminal Settings") }, group: TerminalTabContextMenuGroup.Configure @@ -212,7 +212,7 @@ export function setupTerminalMenus(): void { id: MenuId.ViewTitle, item: { group: 'navigation', command: { - id: TERMINAL_COMMAND_ID.SPLIT, + id: TERMINAL_COMMAND_ID.Split, title: localize('workbench.action.terminal.split', "Split Terminal") }, order: 2, @@ -225,7 +225,7 @@ export function setupTerminalMenus(): void { { id: MenuId.ViewTitle, item: { command: { - id: TERMINAL_COMMAND_ID.SWITCH_TERMINAL, + id: TERMINAL_COMMAND_ID.SwitchTerminal, title: { value: localize('workbench.action.terminal.switchTerminal', "Switch Terminal"), original: 'Switch Terminal' } }, group: 'navigation', @@ -244,7 +244,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalInlineTabContext, item: { command: { - id: TERMINAL_COMMAND_ID.CHANGE_ICON, + id: TERMINAL_COMMAND_ID.ChangeIcon, title: localize('workbench.action.terminal.changeIcon', "Change Icon...") }, group: ContextMenuGroup.Edit, @@ -254,7 +254,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalInlineTabContext, item: { command: { - id: TERMINAL_COMMAND_ID.RENAME, + id: TERMINAL_COMMAND_ID.Rename, title: localize('workbench.action.terminal.rename', "Rename...") } } @@ -262,7 +262,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalInlineTabContext, item: { command: { - id: TERMINAL_COMMAND_ID.RENAME_INSTANCE, + id: TERMINAL_COMMAND_ID.RenameInstance, title: localize('workbench.action.terminal.renameInstance', "Rename...") }, group: ContextMenuGroup.Edit @@ -272,7 +272,7 @@ export function setupTerminalMenus(): void { id: MenuId.TerminalInlineTabContext, item: { group: ContextMenuGroup.Create, command: { - id: TERMINAL_COMMAND_ID.SPLIT, + id: TERMINAL_COMMAND_ID.Split, title: localize('workbench.action.terminal.split', "Split Terminal") } } @@ -280,7 +280,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalInlineTabContext, item: { command: { - id: TERMINAL_COMMAND_ID.KILL, + id: TERMINAL_COMMAND_ID.Kill, title: localize('workbench.action.terminal.kill.short', "Kill Terminal") }, group: ContextMenuGroup.Kill @@ -294,7 +294,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalTabContext, item: { command: { - id: TERMINAL_COMMAND_ID.RENAME_INSTANCE, + id: TERMINAL_COMMAND_ID.RenameInstance, title: localize('workbench.action.terminal.renameInstance', "Rename...") }, group: ContextMenuGroup.Edit @@ -303,7 +303,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalTabContext, item: { command: { - id: TERMINAL_COMMAND_ID.CHANGE_ICON_INSTANCE, + id: TERMINAL_COMMAND_ID.ChangeIconInstance, title: localize('workbench.action.terminal.changeIcon', "Change Icon...") }, group: ContextMenuGroup.Edit @@ -312,7 +312,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalTabContext, item: { command: { - id: TERMINAL_COMMAND_ID.SPLIT_INSTANCE, + id: TERMINAL_COMMAND_ID.SplitInstance, title: localize('workbench.action.terminal.splitInstance', "Split Terminal"), }, group: ContextMenuGroup.Create @@ -321,7 +321,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalTabContext, item: { command: { - id: TERMINAL_COMMAND_ID.KILL_INSTANCE, + id: TERMINAL_COMMAND_ID.KillInstance, title: localize('workbench.action.terminal.killInstance', "Kill Terminal") }, group: ContextMenuGroup.Kill, diff --git a/src/vs/workbench/contrib/terminal/browser/terminalQuickAccess.ts b/src/vs/workbench/contrib/terminal/browser/terminalQuickAccess.ts index 137d1450be44f..0504f0979dc65 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalQuickAccess.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalQuickAccess.ts @@ -52,7 +52,7 @@ export class TerminalQuickAccessProvider extends PickerQuickAccessProvider { switch (buttonIndex) { case 0: - this._commandService.executeCommand(TERMINAL_COMMAND_ID.RENAME, terminal); + this._commandService.executeCommand(TERMINAL_COMMAND_ID.Rename, terminal); return TriggerAction.NO_ACTION; case 1: terminal.dispose(true); @@ -78,13 +78,13 @@ export class TerminalQuickAccessProvider extends PickerQuickAccessProvider this._commandService.executeCommand(TERMINAL_COMMAND_ID.NEW) + accept: () => this._commandService.executeCommand(TERMINAL_COMMAND_ID.New) }); const createWithProfileLabel = localize("workbench.action.terminal.newWithProfilePlus", "Create New Terminal With Profile"); terminalPicks.push({ label: `$(plus) ${createWithProfileLabel}`, ariaLabel: createWithProfileLabel, - accept: () => this._commandService.executeCommand(TERMINAL_COMMAND_ID.NEW_WITH_PROFILE) + accept: () => this._commandService.executeCommand(TERMINAL_COMMAND_ID.NewWithProfile) }); return terminalPicks; diff --git a/src/vs/workbench/contrib/terminal/browser/terminalTabsWidget.ts b/src/vs/workbench/contrib/terminal/browser/terminalTabsWidget.ts index 92722c2c7acec..e9c01e6ef78a0 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalTabsWidget.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalTabsWidget.ts @@ -312,10 +312,10 @@ class TerminalTabsRenderer implements ITreeRenderer { + new Action(TERMINAL_COMMAND_ID.SplitInstance, localize('terminal.split', "Split"), ThemeIcon.asClassName(Codicon.splitHorizontal), true, async () => { this._runForSelectionOrInstance(instance, e => this._terminalService.splitInstance(e)); }), - new Action(TERMINAL_COMMAND_ID.KILL_INSTANCE, localize('terminal.kill', "Kill"), ThemeIcon.asClassName(Codicon.trashcan), true, async () => { + new Action(TERMINAL_COMMAND_ID.KillInstance, localize('terminal.kill', "Kill"), ThemeIcon.asClassName(Codicon.trashcan), true, async () => { this._runForSelectionOrInstance(instance, e => e.dispose()); }) ]; diff --git a/src/vs/workbench/contrib/terminal/browser/terminalView.ts b/src/vs/workbench/contrib/terminal/browser/terminalView.ts index 783a7142a7512..8adbd9df560ec 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalView.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalView.ts @@ -173,15 +173,15 @@ export class TerminalViewPane extends ViewPane { public override getActionViewItem(action: Action): IActionViewItem | undefined { switch (action.id) { - case TERMINAL_COMMAND_ID.SWITCH_TERMINAL: { + case TERMINAL_COMMAND_ID.SwitchTerminal: { return this._instantiationService.createInstance(SwitchTerminalActionViewItem, action); } - case TERMINAL_COMMAND_ID.FOCUS: { + case TERMINAL_COMMAND_ID.Focus: { const actions: IAction[] = []; createAndFillInContextMenuActions(this._singleTabMenu, undefined, actions); return this._instantiationService.createInstance(SingleTerminalTabActionViewItem, action, actions); } - case TERMINAL_COMMAND_ID.CREATE_WITH_PROFILE_BUTTON: { + case TERMINAL_COMMAND_ID.CreateWithProfileButton: { if (this._tabButtons) { this._tabButtons.dispose(); } @@ -210,8 +210,8 @@ export class TerminalViewPane extends ViewPane { const submenuActions: IAction[] = []; for (const p of profiles) { - dropdownActions.push(new MenuItemAction({ id: TERMINAL_COMMAND_ID.NEW_WITH_PROFILE, title: p.profileName, category: TerminalTabContextMenuGroup.Profile }, undefined, { arg: p, shouldForwardArgs: true }, this._contextKeyService, this._commandService)); - submenuActions.push(new MenuItemAction({ id: TERMINAL_COMMAND_ID.SPLIT, title: p.profileName, category: TerminalTabContextMenuGroup.Profile }, undefined, { arg: p, shouldForwardArgs: true }, this._contextKeyService, this._commandService)); + dropdownActions.push(new MenuItemAction({ id: TERMINAL_COMMAND_ID.NewWithProfile, title: p.profileName, category: TerminalTabContextMenuGroup.Profile }, undefined, { arg: p, shouldForwardArgs: true }, this._contextKeyService, this._commandService)); + submenuActions.push(new MenuItemAction({ id: TERMINAL_COMMAND_ID.Split, title: p.profileName, category: TerminalTabContextMenuGroup.Profile }, undefined, { arg: p, shouldForwardArgs: true }, this._contextKeyService, this._commandService)); } for (const contributed of this._terminalContributionService.terminalTypes) { @@ -232,7 +232,7 @@ export class TerminalViewPane extends ViewPane { } } - const primaryAction = this._instantiationService.createInstance(MenuItemAction, { id: TERMINAL_COMMAND_ID.NEW, title: nls.localize('terminal.new', "New Terminal"), icon: Codicon.plus }, undefined, undefined); + const primaryAction = this._instantiationService.createInstance(MenuItemAction, { id: TERMINAL_COMMAND_ID.New, title: nls.localize('terminal.new', "New Terminal"), icon: Codicon.plus }, undefined, undefined); const dropdownAction = new Action('refresh profiles', 'Launch Profile...', 'codicon-chevron-down', true); return { primaryAction, dropdownAction, dropdownMenuActions: dropdownActions, className: 'terminal-tab-actions' }; } diff --git a/src/vs/workbench/contrib/terminal/common/terminal.ts b/src/vs/workbench/contrib/terminal/common/terminal.ts index 9fde5372369b8..5f0aaaeff9c51 100644 --- a/src/vs/workbench/contrib/terminal/common/terminal.ts +++ b/src/vs/workbench/contrib/terminal/common/terminal.ts @@ -478,134 +478,134 @@ export const enum TERMINAL_SETTING_ID { } export const enum TERMINAL_COMMAND_ID { - FIND_NEXT = 'workbench.action.terminal.findNext', - FIND_PREVIOUS = 'workbench.action.terminal.findPrevious', - TOGGLE = 'workbench.action.terminal.toggleTerminal', - KILL = 'workbench.action.terminal.kill', - KILL_INSTANCE = 'workbench.action.terminal.killInstance', - QUICK_KILL = 'workbench.action.terminal.quickKill', - CONFIGURE_TERMINAL_SETTINGS = 'workbench.action.terminal.openSettings', - COPY_SELECTION = 'workbench.action.terminal.copySelection', - SELECT_ALL = 'workbench.action.terminal.selectAll', - DELETE_WORD_LEFT = 'workbench.action.terminal.deleteWordLeft', - DELETE_WORD_RIGHT = 'workbench.action.terminal.deleteWordRight', - DELETE_TO_LINE_START = 'workbench.action.terminal.deleteToLineStart', - MOVE_TO_LINE_START = 'workbench.action.terminal.moveToLineStart', - MOVE_TO_LINE_END = 'workbench.action.terminal.moveToLineEnd', - NEW = 'workbench.action.terminal.new', - NEW_WITH_CWD = 'workbench.action.terminal.newWithCwd', - NEW_LOCAL = 'workbench.action.terminal.newLocal', - NEW_IN_ACTIVE_WORKSPACE = 'workbench.action.terminal.newInActiveWorkspace', - NEW_WITH_PROFILE = 'workbench.action.terminal.newWithProfile', - SPLIT = 'workbench.action.terminal.split', - SPLIT_INSTANCE = 'workbench.action.terminal.splitInstance', - SPLIT_IN_ACTIVE_WORKSPACE = 'workbench.action.terminal.splitInActiveWorkspace', - RELAUNCH = 'workbench.action.terminal.relaunch', - FOCUS_PREVIOUS_PANE = 'workbench.action.terminal.focusPreviousPane', - SHOW_TABS = 'workbench.action.terminal.showTabs', - FOCUS_TABS = 'workbench.action.terminal.focusTabs', - FOCUS_NEXT_PANE = 'workbench.action.terminal.focusNextPane', - RESIZE_PANE_LEFT = 'workbench.action.terminal.resizePaneLeft', - RESIZE_PANE_RIGHT = 'workbench.action.terminal.resizePaneRight', - RESIZE_PANE_UP = 'workbench.action.terminal.resizePaneUp', - CREATE_WITH_PROFILE_BUTTON = 'workbench.action.terminal.createProfileButton', - RESIZE_PANE_DOWN = 'workbench.action.terminal.resizePaneDown', - FOCUS = 'workbench.action.terminal.focus', - FOCUS_NEXT = 'workbench.action.terminal.focusNext', - FOCUS_PREVIOUS = 'workbench.action.terminal.focusPrevious', - PASTE = 'workbench.action.terminal.paste', - PASTE_SELECTION = 'workbench.action.terminal.pasteSelection', - SELECT_DEFAULT_PROFILE = 'workbench.action.terminal.selectDefaultShell', - RUN_SELECTED_TEXT = 'workbench.action.terminal.runSelectedText', - RUN_ACTIVE_FILE = 'workbench.action.terminal.runActiveFile', - SWITCH_TERMINAL = 'workbench.action.terminal.switchTerminal', - SCROLL_DOWN_LINE = 'workbench.action.terminal.scrollDown', - SCROLL_DOWN_PAGE = 'workbench.action.terminal.scrollDownPage', - SCROLL_TO_BOTTOM = 'workbench.action.terminal.scrollToBottom', - SCROLL_UP_LINE = 'workbench.action.terminal.scrollUp', - SCROLL_UP_PAGE = 'workbench.action.terminal.scrollUpPage', - SCROLL_TO_TOP = 'workbench.action.terminal.scrollToTop', - CLEAR = 'workbench.action.terminal.clear', - CLEAR_SELECTION = 'workbench.action.terminal.clearSelection', - CHANGE_ICON = 'workbench.action.terminal.changeIcon', - CHANGE_ICON_INSTANCE = 'workbench.action.terminal.changeIconInstance', - RENAME = 'workbench.action.terminal.rename', - RENAME_INSTANCE = 'workbench.action.terminal.renameInstance', - RENAME_WITH_ARG = 'workbench.action.terminal.renameWithArg', - FIND_FOCUS = 'workbench.action.terminal.focusFind', - FIND_HIDE = 'workbench.action.terminal.hideFind', - QUICK_OPEN_TERM = 'workbench.action.quickOpenTerm', - SCROLL_TO_PREVIOUS_COMMAND = 'workbench.action.terminal.scrollToPreviousCommand', - SCROLL_TO_NEXT_COMMAND = 'workbench.action.terminal.scrollToNextCommand', - SELECT_TO_PREVIOUS_COMMAND = 'workbench.action.terminal.selectToPreviousCommand', - SELECT_TO_NEXT_COMMAND = 'workbench.action.terminal.selectToNextCommand', - SELECT_TO_PREVIOUS_LINE = 'workbench.action.terminal.selectToPreviousLine', - SELECT_TO_NEXT_LINE = 'workbench.action.terminal.selectToNextLine', - TOGGLE_ESCAPE_SEQUENCE_LOGGING = 'toggleEscapeSequenceLogging', - SEND_SEQUENCE = 'workbench.action.terminal.sendSequence', - TOGGLE_FIND_REGEX = 'workbench.action.terminal.toggleFindRegex', - TOGGLE_FIND_WHOLE_WORD = 'workbench.action.terminal.toggleFindWholeWord', - TOGGLE_FIND_CASE_SENSITIVE = 'workbench.action.terminal.toggleFindCaseSensitive', - NAVIGATION_MODE_EXIT = 'workbench.action.terminal.navigationModeExit', - NAVIGATION_MODE_FOCUS_NEXT = 'workbench.action.terminal.navigationModeFocusNext', - NAVIGATION_MODE_FOCUS_PREVIOUS = 'workbench.action.terminal.navigationModeFocusPrevious', - SHOW_ENVIRONMENT_INFORMATION = 'workbench.action.terminal.showEnvironmentInformation', - SEARCH_WORKSPACE = 'workbench.action.terminal.searchWorkspace', - ATTACH_TO_REMOTE_TERMINAL = 'workbench.action.terminal.attachToSession' + FindNext = 'workbench.action.terminal.findNext', + FindPrevious = 'workbench.action.terminal.findPrevious', + Toggle = 'workbench.action.terminal.toggleTerminal', + Kill = 'workbench.action.terminal.kill', + KillInstance = 'workbench.action.terminal.killInstance', + QuickKill = 'workbench.action.terminal.quickKill', + ConfigureTerminalSettings = 'workbench.action.terminal.openSettings', + CopySelection = 'workbench.action.terminal.copySelection', + SelectAll = 'workbench.action.terminal.selectAll', + DeleteWordLeft = 'workbench.action.terminal.deleteWordLeft', + DeleteWordRight = 'workbench.action.terminal.deleteWordRight', + DeleteToLineStart = 'workbench.action.terminal.deleteToLineStart', + MoveToLineStart = 'workbench.action.terminal.moveToLineStart', + MoveToLineEnd = 'workbench.action.terminal.moveToLineEnd', + New = 'workbench.action.terminal.new', + NewWithCwd = 'workbench.action.terminal.newWithCwd', + NewLocal = 'workbench.action.terminal.newLocal', + NewInActiveWorkspace = 'workbench.action.terminal.newInActiveWorkspace', + NewWithProfile = 'workbench.action.terminal.newWithProfile', + Split = 'workbench.action.terminal.split', + SplitInstance = 'workbench.action.terminal.splitInstance', + SplitInActiveWorkspace = 'workbench.action.terminal.splitInActiveWorkspace', + Relaunch = 'workbench.action.terminal.relaunch', + FocusPreviousPane = 'workbench.action.terminal.focusPreviousPane', + ShowTabs = 'workbench.action.terminal.showTabs', + FocusTabs = 'workbench.action.terminal.focusTabs', + FocusNextPane = 'workbench.action.terminal.focusNextPane', + ResizePaneLeft = 'workbench.action.terminal.resizePaneLeft', + ResizePaneRight = 'workbench.action.terminal.resizePaneRight', + ResizePaneUp = 'workbench.action.terminal.resizePaneUp', + CreateWithProfileButton = 'workbench.action.terminal.createProfileButton', + ResizePaneDown = 'workbench.action.terminal.resizePaneDown', + Focus = 'workbench.action.terminal.focus', + FocusNext = 'workbench.action.terminal.focusNext', + FocusPrevious = 'workbench.action.terminal.focusPrevious', + Paste = 'workbench.action.terminal.paste', + PasteSelection = 'workbench.action.terminal.pasteSelection', + SelectDefaultProfile = 'workbench.action.terminal.selectDefaultShell', + RunSelectedText = 'workbench.action.terminal.runSelectedText', + RunActiveFile = 'workbench.action.terminal.runActiveFile', + SwitchTerminal = 'workbench.action.terminal.switchTerminal', + ScrollDownLine = 'workbench.action.terminal.scrollDown', + ScrollDownPage = 'workbench.action.terminal.scrollDownPage', + ScrollToBottom = 'workbench.action.terminal.scrollToBottom', + ScrollUpLine = 'workbench.action.terminal.scrollUp', + ScrollUpPage = 'workbench.action.terminal.scrollUpPage', + ScrollToTop = 'workbench.action.terminal.scrollToTop', + Clear = 'workbench.action.terminal.clear', + ClearSelection = 'workbench.action.terminal.clearSelection', + ChangeIcon = 'workbench.action.terminal.changeIcon', + ChangeIconInstance = 'workbench.action.terminal.changeIconInstance', + Rename = 'workbench.action.terminal.rename', + RenameInstance = 'workbench.action.terminal.renameInstance', + RenameWithArgs = 'workbench.action.terminal.renameWithArg', + FindFocus = 'workbench.action.terminal.focusFind', + FindHide = 'workbench.action.terminal.hideFind', + QuickOpenTerm = 'workbench.action.quickOpenTerm', + ScrollToPreviousCommand = 'workbench.action.terminal.scrollToPreviousCommand', + ScrollToNextCommand = 'workbench.action.terminal.scrollToNextCommand', + SelectToPreviousCommand = 'workbench.action.terminal.selectToPreviousCommand', + SelectToNextCommand = 'workbench.action.terminal.selectToNextCommand', + SelectToPreviousLine = 'workbench.action.terminal.selectToPreviousLine', + SelectToNextLine = 'workbench.action.terminal.selectToNextLine', + ToggleEscapeSequenceLogging = 'toggleEscapeSequenceLogging', + SendSequence = 'workbench.action.terminal.sendSequence', + ToggleFindRegex = 'workbench.action.terminal.toggleFindRegex', + ToggleFindWholeWord = 'workbench.action.terminal.toggleFindWholeWord', + ToggleFindCaseSensitive = 'workbench.action.terminal.toggleFindCaseSensitive', + NavigationModeExit = 'workbench.action.terminal.navigationModeExit', + NavigationModeFocusNext = 'workbench.action.terminal.navigationModeFocusNext', + NavigationModeFocusPrevious = 'workbench.action.terminal.navigationModeFocusPrevious', + ShowEnvironmentInformation = 'workbench.action.terminal.showEnvironmentInformation', + SearchWorkspace = 'workbench.action.terminal.searchWorkspace', + AttachToRemoteTerminal = 'workbench.action.terminal.attachToSession' } export const DEFAULT_COMMANDS_TO_SKIP_SHELL: string[] = [ - TERMINAL_COMMAND_ID.CLEAR_SELECTION, - TERMINAL_COMMAND_ID.CLEAR, - TERMINAL_COMMAND_ID.COPY_SELECTION, - TERMINAL_COMMAND_ID.DELETE_TO_LINE_START, - TERMINAL_COMMAND_ID.DELETE_WORD_LEFT, - TERMINAL_COMMAND_ID.DELETE_WORD_RIGHT, - TERMINAL_COMMAND_ID.FIND_FOCUS, - TERMINAL_COMMAND_ID.FIND_HIDE, - TERMINAL_COMMAND_ID.FIND_NEXT, - TERMINAL_COMMAND_ID.FIND_PREVIOUS, - TERMINAL_COMMAND_ID.TOGGLE_FIND_REGEX, - TERMINAL_COMMAND_ID.TOGGLE_FIND_WHOLE_WORD, - TERMINAL_COMMAND_ID.TOGGLE_FIND_CASE_SENSITIVE, - TERMINAL_COMMAND_ID.FOCUS_NEXT_PANE, - TERMINAL_COMMAND_ID.FOCUS_NEXT, - TERMINAL_COMMAND_ID.FOCUS_PREVIOUS_PANE, - TERMINAL_COMMAND_ID.FOCUS_PREVIOUS, - TERMINAL_COMMAND_ID.FOCUS, - TERMINAL_COMMAND_ID.KILL, - TERMINAL_COMMAND_ID.MOVE_TO_LINE_END, - TERMINAL_COMMAND_ID.MOVE_TO_LINE_START, - TERMINAL_COMMAND_ID.NEW_IN_ACTIVE_WORKSPACE, - TERMINAL_COMMAND_ID.NEW, - TERMINAL_COMMAND_ID.PASTE, - TERMINAL_COMMAND_ID.PASTE_SELECTION, - TERMINAL_COMMAND_ID.RESIZE_PANE_DOWN, - TERMINAL_COMMAND_ID.RESIZE_PANE_LEFT, - TERMINAL_COMMAND_ID.RESIZE_PANE_RIGHT, - TERMINAL_COMMAND_ID.RESIZE_PANE_UP, - TERMINAL_COMMAND_ID.RUN_ACTIVE_FILE, - TERMINAL_COMMAND_ID.RUN_SELECTED_TEXT, - TERMINAL_COMMAND_ID.SCROLL_DOWN_LINE, - TERMINAL_COMMAND_ID.SCROLL_DOWN_PAGE, - TERMINAL_COMMAND_ID.SCROLL_TO_BOTTOM, - TERMINAL_COMMAND_ID.SCROLL_TO_NEXT_COMMAND, - TERMINAL_COMMAND_ID.SCROLL_TO_PREVIOUS_COMMAND, - TERMINAL_COMMAND_ID.SCROLL_TO_TOP, - TERMINAL_COMMAND_ID.SCROLL_UP_LINE, - TERMINAL_COMMAND_ID.SCROLL_UP_PAGE, - TERMINAL_COMMAND_ID.SEND_SEQUENCE, - TERMINAL_COMMAND_ID.SELECT_ALL, - TERMINAL_COMMAND_ID.SELECT_TO_NEXT_COMMAND, - TERMINAL_COMMAND_ID.SELECT_TO_NEXT_LINE, - TERMINAL_COMMAND_ID.SELECT_TO_PREVIOUS_COMMAND, - TERMINAL_COMMAND_ID.SELECT_TO_PREVIOUS_LINE, - TERMINAL_COMMAND_ID.SPLIT_IN_ACTIVE_WORKSPACE, - TERMINAL_COMMAND_ID.SPLIT, - TERMINAL_COMMAND_ID.TOGGLE, - TERMINAL_COMMAND_ID.NAVIGATION_MODE_EXIT, - TERMINAL_COMMAND_ID.NAVIGATION_MODE_FOCUS_NEXT, - TERMINAL_COMMAND_ID.NAVIGATION_MODE_FOCUS_PREVIOUS, + TERMINAL_COMMAND_ID.ClearSelection, + TERMINAL_COMMAND_ID.Clear, + TERMINAL_COMMAND_ID.CopySelection, + TERMINAL_COMMAND_ID.DeleteToLineStart, + TERMINAL_COMMAND_ID.DeleteWordLeft, + TERMINAL_COMMAND_ID.DeleteWordRight, + TERMINAL_COMMAND_ID.FindFocus, + TERMINAL_COMMAND_ID.FindHide, + TERMINAL_COMMAND_ID.FindNext, + TERMINAL_COMMAND_ID.FindPrevious, + TERMINAL_COMMAND_ID.ToggleFindRegex, + TERMINAL_COMMAND_ID.ToggleFindWholeWord, + TERMINAL_COMMAND_ID.ToggleFindCaseSensitive, + TERMINAL_COMMAND_ID.FocusNextPane, + TERMINAL_COMMAND_ID.FocusNext, + TERMINAL_COMMAND_ID.FocusPreviousPane, + TERMINAL_COMMAND_ID.FocusPrevious, + TERMINAL_COMMAND_ID.Focus, + TERMINAL_COMMAND_ID.Kill, + TERMINAL_COMMAND_ID.MoveToLineEnd, + TERMINAL_COMMAND_ID.MoveToLineStart, + TERMINAL_COMMAND_ID.NewInActiveWorkspace, + TERMINAL_COMMAND_ID.New, + TERMINAL_COMMAND_ID.Paste, + TERMINAL_COMMAND_ID.PasteSelection, + TERMINAL_COMMAND_ID.ResizePaneDown, + TERMINAL_COMMAND_ID.ResizePaneLeft, + TERMINAL_COMMAND_ID.ResizePaneRight, + TERMINAL_COMMAND_ID.ResizePaneUp, + TERMINAL_COMMAND_ID.RunActiveFile, + TERMINAL_COMMAND_ID.RunSelectedText, + TERMINAL_COMMAND_ID.ScrollDownLine, + TERMINAL_COMMAND_ID.ScrollDownPage, + TERMINAL_COMMAND_ID.ScrollToBottom, + TERMINAL_COMMAND_ID.ScrollToNextCommand, + TERMINAL_COMMAND_ID.ScrollToPreviousCommand, + TERMINAL_COMMAND_ID.ScrollToTop, + TERMINAL_COMMAND_ID.ScrollUpLine, + TERMINAL_COMMAND_ID.ScrollUpPage, + TERMINAL_COMMAND_ID.SendSequence, + TERMINAL_COMMAND_ID.SelectAll, + TERMINAL_COMMAND_ID.SelectToNextCommand, + TERMINAL_COMMAND_ID.SelectToNextLine, + TERMINAL_COMMAND_ID.SelectToPreviousCommand, + TERMINAL_COMMAND_ID.SelectToPreviousLine, + TERMINAL_COMMAND_ID.SplitInActiveWorkspace, + TERMINAL_COMMAND_ID.Split, + TERMINAL_COMMAND_ID.Toggle, + TERMINAL_COMMAND_ID.NavigationModeExit, + TERMINAL_COMMAND_ID.NavigationModeFocusNext, + TERMINAL_COMMAND_ID.NavigationModeFocusPrevious, 'editor.action.toggleTabFocusMode', 'workbench.action.quickOpen', 'workbench.action.quickOpenPreviousEditor', diff --git a/src/vs/workbench/contrib/terminal/electron-sandbox/terminalRemote.ts b/src/vs/workbench/contrib/terminal/electron-sandbox/terminalRemote.ts index 677c5dfcb8a2e..f862a2f43e596 100644 --- a/src/vs/workbench/contrib/terminal/electron-sandbox/terminalRemote.ts +++ b/src/vs/workbench/contrib/terminal/electron-sandbox/terminalRemote.ts @@ -18,7 +18,7 @@ export function registerRemoteContributions() { } export class CreateNewLocalTerminalAction extends Action { - public static readonly ID = TERMINAL_COMMAND_ID.NEW_LOCAL; + public static readonly ID = TERMINAL_COMMAND_ID.NewLocal; public static readonly LABEL = nls.localize('workbench.action.terminal.newLocal', "Create New Integrated Terminal (Local)"); constructor( diff --git a/src/vs/workbench/contrib/terminal/test/browser/links/terminalLinkHelpers.test.ts b/src/vs/workbench/contrib/terminal/test/browser/links/terminalLinkHelpers.test.ts index c803351966c63..56c271e5825ae 100644 --- a/src/vs/workbench/contrib/terminal/test/browser/links/terminalLinkHelpers.test.ts +++ b/src/vs/workbench/contrib/terminal/test/browser/links/terminalLinkHelpers.test.ts @@ -157,7 +157,7 @@ const TEST_WIDE_CHAR = '文'; const TEST_NULL_CHAR = 'C'; function createBufferLineArray(lines: { text: string, width: number }[]): IBufferLine[] { - let result: IBufferLine[] = []; + const result: IBufferLine[] = []; lines.forEach((l, i) => { result.push(new TestBufferLine( l.text, @@ -178,9 +178,9 @@ class TestBufferLine implements IBufferLine { } getCell(x: number): IBufferCell | undefined { // Create a fake line of cells and use that to resolve the width - let cells: string[] = []; + const cells: string[] = []; let wideNullCellOffset = 0; // There is no null 0 width char after a wide char - let emojiOffset = 0; // Skip chars as emoji are multiple characters + const emojiOffset = 0; // Skip chars as emoji are multiple characters for (let i = 0; i <= x - wideNullCellOffset + emojiOffset; i++) { let char = this._text.charAt(i); if (char === '\ud83d') { diff --git a/src/vs/workbench/contrib/watermark/browser/watermark.ts b/src/vs/workbench/contrib/watermark/browser/watermark.ts index d6840773e0b54..66b0aa3861934 100644 --- a/src/vs/workbench/contrib/watermark/browser/watermark.ts +++ b/src/vs/workbench/contrib/watermark/browser/watermark.ts @@ -46,7 +46,7 @@ const openFileOrFolderMacOnly: WatermarkEntry = { text: nls.localize('watermark. const openRecent: WatermarkEntry = { text: nls.localize('watermark.openRecent', "Open Recent"), id: 'workbench.action.openRecent' }; const newUntitledFile: WatermarkEntry = { text: nls.localize('watermark.newUntitledFile', "New Untitled File"), id: NEW_UNTITLED_FILE_COMMAND_ID }; const newUntitledFileMacOnly: WatermarkEntry = Object.assign({ mac: true }, newUntitledFile); -const toggleTerminal: WatermarkEntry = { text: nls.localize({ key: 'watermark.toggleTerminal', comment: ['toggle is a verb here'] }, "Toggle Terminal"), id: TERMINAL_COMMAND_ID.TOGGLE }; +const toggleTerminal: WatermarkEntry = { text: nls.localize({ key: 'watermark.toggleTerminal', comment: ['toggle is a verb here'] }, "Toggle Terminal"), id: TERMINAL_COMMAND_ID.Toggle }; const findInFiles: WatermarkEntry = { text: nls.localize('watermark.findInFiles', "Find in Files"), id: FindInFilesActionId }; const startDebugging: WatermarkEntry = { text: nls.localize('watermark.startDebugging', "Start Debugging"), id: DEBUG_START_COMMAND_ID }; From 4fde14b9ef2bc9934cbb24fe427f8768d00d34de Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 4 May 2021 05:40:33 -0700 Subject: [PATCH 4/5] Use pascal case for term enums --- .../api/node/extHostTerminalService.ts | 4 +- .../tasks/browser/terminalTaskSystem.ts | 4 +- .../browser/environmentVariableInfo.ts | 4 +- .../terminal/browser/terminal.contribution.ts | 6 +- .../browser/terminal.web.contribution.ts | 4 +- .../terminal/browser/terminalActions.ts | 148 +++++++++--------- .../terminal/browser/terminalInstance.ts | 18 +-- .../contrib/terminal/browser/terminalMenus.ts | 62 ++++---- .../browser/terminalProcessManager.ts | 46 +++--- .../browser/terminalProfileResolverService.ts | 4 +- .../terminal/browser/terminalQuickAccess.ts | 8 +- .../terminal/browser/terminalService.ts | 18 +-- .../terminal/browser/terminalTabbedView.ts | 16 +- .../terminal/browser/terminalTabsWidget.ts | 8 +- .../contrib/terminal/browser/terminalView.ts | 18 +-- .../contrib/terminal/common/terminal.ts | 118 +++++++------- .../terminal/common/terminalConfiguration.ts | 138 ++++++++-------- .../terminal/common/terminalEnvironment.ts | 20 +-- .../electron-sandbox/terminalRemote.ts | 4 +- .../contrib/terminal/node/terminalProfiles.ts | 8 +- .../contrib/watermark/browser/watermark.ts | 4 +- 21 files changed, 330 insertions(+), 330 deletions(-) diff --git a/src/vs/workbench/api/node/extHostTerminalService.ts b/src/vs/workbench/api/node/extHostTerminalService.ts index ddf40c760ccf4..6cd875992d2aa 100644 --- a/src/vs/workbench/api/node/extHostTerminalService.ts +++ b/src/vs/workbench/api/node/extHostTerminalService.ts @@ -17,7 +17,7 @@ import { ExtHostDocumentsAndEditors, IExtHostDocumentsAndEditors } from 'vs/work import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; import { BaseExtHostTerminalService, ExtHostTerminal } from 'vs/workbench/api/common/extHostTerminalService'; import { ExtHostWorkspace, IExtHostWorkspace } from 'vs/workbench/api/common/extHostWorkspace'; -import { ITerminalProfile, TERMINAL_SETTING_ID } from 'vs/workbench/contrib/terminal/common/terminal'; +import { ITerminalProfile, TerminalSettingId } from 'vs/workbench/contrib/terminal/common/terminal'; import * as terminalEnvironment from 'vs/workbench/contrib/terminal/common/terminalEnvironment'; import { detectAvailableProfiles } from 'vs/workbench/contrib/terminal/node/terminalProfiles'; import type * as vscode from 'vscode'; @@ -134,7 +134,7 @@ export class ExtHostTerminalService extends BaseExtHostTerminalService { private _buildSafeConfigProvider(configProvider: ExtHostConfigProvider): SafeConfigProvider { const config = configProvider.getConfiguration(); return (key: string) => { - const isWorkspaceConfigAllowed = config.get(TERMINAL_SETTING_ID.AllowWorkspaceConfiguration); + const isWorkspaceConfigAllowed = config.get(TerminalSettingId.AllowWorkspaceConfiguration); if (isWorkspaceConfigAllowed) { return config.get(key) as any; } diff --git a/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts b/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts index f1bc1a55ff5e6..bd65126480cf5 100644 --- a/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts +++ b/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts @@ -27,7 +27,7 @@ import Constants from 'vs/workbench/contrib/markers/browser/constants'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver'; -import { ITerminalProfileResolverService, TERMINAL_SETTING_ID, TERMINAL_VIEW_ID } from 'vs/workbench/contrib/terminal/common/terminal'; +import { ITerminalProfileResolverService, TerminalSettingId, TERMINAL_VIEW_ID } from 'vs/workbench/contrib/terminal/common/terminal'; import { ITerminalService, ITerminalInstance } from 'vs/workbench/contrib/terminal/browser/terminal'; import { IOutputService } from 'vs/workbench/contrib/output/common/output'; import { StartStopProblemCollector, WatchingProblemCollector, ProblemCollectorEventKind, ProblemHandlingStrategy } from 'vs/workbench/contrib/tasks/common/problemCollectors'; @@ -1074,7 +1074,7 @@ export class TerminalTaskSystem implements ITaskSystem { // Under Mac remove -l to not start it as a login shell. if (platform === Platform.Platform.Mac) { // Background on -l on osx https://github.com/microsoft/vscode/issues/107563 - const osxShellArgs = this.configurationService.inspect(TERMINAL_SETTING_ID.ShellArgsMacOs); + const osxShellArgs = this.configurationService.inspect(TerminalSettingId.ShellArgsMacOs); if ((osxShellArgs.user === undefined) && (osxShellArgs.userLocal === undefined) && (osxShellArgs.userLocalValue === undefined) && (osxShellArgs.userRemote === undefined) && (osxShellArgs.userRemoteValue === undefined) && (osxShellArgs.userValue === undefined) && (osxShellArgs.workspace === undefined) diff --git a/src/vs/workbench/contrib/terminal/browser/environmentVariableInfo.ts b/src/vs/workbench/contrib/terminal/browser/environmentVariableInfo.ts index 456ab8e244ab1..4b2b0bdc42668 100644 --- a/src/vs/workbench/contrib/terminal/browser/environmentVariableInfo.ts +++ b/src/vs/workbench/contrib/terminal/browser/environmentVariableInfo.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { EnvironmentVariableMutatorType, IEnvironmentVariableInfo, IMergedEnvironmentVariableCollection, IMergedEnvironmentVariableCollectionDiff } from 'vs/workbench/contrib/terminal/common/environmentVariable'; -import { TERMINAL_COMMAND_ID } from 'vs/workbench/contrib/terminal/common/terminal'; +import { TerminalCommandId } from 'vs/workbench/contrib/terminal/common/terminal'; import { ITerminalService } from 'vs/workbench/contrib/terminal/browser/terminal'; import { localize } from 'vs/nls'; import { ThemeIcon } from 'vs/platform/theme/common/themeService'; @@ -64,7 +64,7 @@ export class EnvironmentVariableInfoStale implements IEnvironmentVariableInfo { return [{ label: localize('relaunchTerminalLabel', "Relaunch terminal"), run: () => this._terminalService.getInstanceFromId(this._terminalId)?.relaunch(), - commandId: TERMINAL_COMMAND_ID.Relaunch + commandId: TerminalCommandId.Relaunch }]; } } diff --git a/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts b/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts index ff2b18bd942de..004ee4614b1d4 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts @@ -18,7 +18,7 @@ import { getQuickNavigateHandler } from 'vs/workbench/browser/quickaccess'; import { Extensions as ViewContainerExtensions, IViewContainersRegistry, ViewContainerLocation, IViewsRegistry } from 'vs/workbench/common/views'; import { registerTerminalActions, terminalSendSequenceCommand } from 'vs/workbench/contrib/terminal/browser/terminalActions'; import { TerminalViewPane } from 'vs/workbench/contrib/terminal/browser/terminalView'; -import { KEYBINDING_CONTEXT_TERMINAL_SHELL_TYPE_KEY, KEYBINDING_CONTEXT_TERMINAL_FOCUS, TERMINAL_VIEW_ID, TERMINAL_COMMAND_ID } from 'vs/workbench/contrib/terminal/common/terminal'; +import { KEYBINDING_CONTEXT_TERMINAL_SHELL_TYPE_KEY, KEYBINDING_CONTEXT_TERMINAL_FOCUS, TERMINAL_VIEW_ID, TerminalCommandId } from 'vs/workbench/contrib/terminal/common/terminal'; import { registerColors } from 'vs/workbench/contrib/terminal/common/terminalColorRegistry'; import { setupTerminalCommands } from 'vs/workbench/contrib/terminal/browser/terminalCommands'; import { IConfigurationRegistry, Extensions } from 'vs/platform/configuration/common/configurationRegistry'; @@ -82,7 +82,7 @@ Registry.as(ViewContainerExtensions.ViewsRegistry).registerViews canMoveView: true, ctorDescriptor: new SyncDescriptor(TerminalViewPane), openCommandActionDescriptor: { - id: TERMINAL_COMMAND_ID.Toggle, + id: TerminalCommandId.Toggle, mnemonicTitle: nls.localize({ key: 'miToggleIntegratedTerminal', comment: ['&& denotes a mnemonic'] }, "&&Terminal"), keybindings: { primary: KeyMod.CtrlCmd | KeyCode.US_BACKTICK, @@ -97,7 +97,7 @@ registerTerminalActions(); function registerSendSequenceKeybinding(text: string, rule: { when?: ContextKeyExpression } & IKeybindings): void { KeybindingsRegistry.registerCommandAndKeybindingRule({ - id: TERMINAL_COMMAND_ID.SendSequence, + id: TerminalCommandId.SendSequence, weight: KeybindingWeight.WorkbenchContrib, when: rule.when || KEYBINDING_CONTEXT_TERMINAL_FOCUS, primary: rule.primary, diff --git a/src/vs/workbench/contrib/terminal/browser/terminal.web.contribution.ts b/src/vs/workbench/contrib/terminal/browser/terminal.web.contribution.ts index 0c249d92fc428..79728c559199a 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminal.web.contribution.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminal.web.contribution.ts @@ -5,7 +5,7 @@ import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { KeybindingWeight, KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; -import { ITerminalProfileResolverService, TERMINAL_COMMAND_ID } from 'vs/workbench/contrib/terminal/common/terminal'; +import { ITerminalProfileResolverService, TerminalCommandId } from 'vs/workbench/contrib/terminal/common/terminal'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { BrowserTerminalProfileResolverService } from 'vs/workbench/contrib/terminal/browser/terminalProfileResolverService'; @@ -14,7 +14,7 @@ registerSingleton(ITerminalProfileResolverService, BrowserTerminalProfileResolve // Register standard external terminal keybinding as integrated terminal when in web as the // external terminal is not available KeybindingsRegistry.registerKeybindingRule({ - id: TERMINAL_COMMAND_ID.New, + id: TerminalCommandId.New, weight: KeybindingWeight.WorkbenchContrib, when: undefined, primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_C diff --git a/src/vs/workbench/contrib/terminal/browser/terminalActions.ts b/src/vs/workbench/contrib/terminal/browser/terminalActions.ts index 82148c53dc733..73a6c16929e7b 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalActions.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalActions.ts @@ -32,7 +32,7 @@ import { PICK_WORKSPACE_FOLDER_COMMAND_ID } from 'vs/workbench/browser/actions/w import { FindInFilesCommand, IFindInFilesArgs } from 'vs/workbench/contrib/search/browser/searchActions'; import { Direction, IRemoteTerminalService, ITerminalInstance, ITerminalService } from 'vs/workbench/contrib/terminal/browser/terminal'; import { TerminalQuickAccessProvider } from 'vs/workbench/contrib/terminal/browser/terminalQuickAccess'; -import { IRemoteTerminalAttachTarget, ITerminalConfigHelper, ITerminalProfile, KEYBINDING_CONTEXT_TERMINAL_A11Y_TREE_FOCUS, KEYBINDING_CONTEXT_TERMINAL_ALT_BUFFER_ACTIVE, KEYBINDING_CONTEXT_TERMINAL_FIND_FOCUSED, KEYBINDING_CONTEXT_TERMINAL_FIND_NOT_VISIBLE, KEYBINDING_CONTEXT_TERMINAL_FIND_VISIBLE, KEYBINDING_CONTEXT_TERMINAL_FOCUS, KEYBINDING_CONTEXT_TERMINAL_IS_OPEN, KEYBINDING_CONTEXT_TERMINAL_PROCESS_SUPPORTED, KEYBINDING_CONTEXT_TERMINAL_TABS_FOCUS, KEYBINDING_CONTEXT_TERMINAL_TABS_SINGULAR_SELECTION, KEYBINDING_CONTEXT_TERMINAL_TEXT_SELECTED, TERMINAL_ACTION_CATEGORY, TERMINAL_COMMAND_ID, TERMINAL_SETTING_ID, TERMINAL_VIEW_ID, TitleEventSource } from 'vs/workbench/contrib/terminal/common/terminal'; +import { IRemoteTerminalAttachTarget, ITerminalConfigHelper, ITerminalProfile, KEYBINDING_CONTEXT_TERMINAL_A11Y_TREE_FOCUS, KEYBINDING_CONTEXT_TERMINAL_ALT_BUFFER_ACTIVE, KEYBINDING_CONTEXT_TERMINAL_FIND_FOCUSED, KEYBINDING_CONTEXT_TERMINAL_FIND_NOT_VISIBLE, KEYBINDING_CONTEXT_TERMINAL_FIND_VISIBLE, KEYBINDING_CONTEXT_TERMINAL_FOCUS, KEYBINDING_CONTEXT_TERMINAL_IS_OPEN, KEYBINDING_CONTEXT_TERMINAL_PROCESS_SUPPORTED, KEYBINDING_CONTEXT_TERMINAL_TABS_FOCUS, KEYBINDING_CONTEXT_TERMINAL_TABS_SINGULAR_SELECTION, KEYBINDING_CONTEXT_TERMINAL_TEXT_SELECTED, TERMINAL_ACTION_CATEGORY, TerminalCommandId, TerminalSettingId, TERMINAL_VIEW_ID, TitleEventSource } from 'vs/workbench/contrib/terminal/common/terminal'; import { ITerminalContributionService } from 'vs/workbench/contrib/terminal/common/terminalExtensionPoints'; import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver'; import { IHistoryService } from 'vs/workbench/services/history/common/history'; @@ -105,7 +105,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.NewInActiveWorkspace, + id: TerminalCommandId.NewInActiveWorkspace, title: { value: localize('workbench.action.terminal.newInActiveWorkspace', "Create New Integrated Terminal (In Active Workspace)"), original: 'Create New Integrated Terminal (In Active Workspace)' }, f1: true, category @@ -126,7 +126,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.NewWithProfile, + id: TerminalCommandId.NewWithProfile, title: { value: localize('workbench.action.terminal.newWithProfile', "Create New Integrated Terminal (With Profile)"), original: 'Create New Integrated Terminal (With Profile)' }, f1: true, category, @@ -195,7 +195,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.ShowTabs, + id: TerminalCommandId.ShowTabs, title: { value: localize('workbench.action.terminal.showTabs', "Show Tabs"), original: 'Show Tabs' }, f1: false, category, @@ -211,7 +211,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.FocusPreviousPane, + id: TerminalCommandId.FocusPreviousPane, title: { value: localize('workbench.action.terminal.focusPreviousPane', "Focus Previous Pane"), original: 'Focus Previous Pane' }, f1: true, category, @@ -237,7 +237,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.FocusNextPane, + id: TerminalCommandId.FocusNextPane, title: { value: localize('workbench.action.terminal.focusNextPane', "Focus Next Pane"), original: 'Focus Next Pane' }, f1: true, category, @@ -263,7 +263,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.ResizePaneLeft, + id: TerminalCommandId.ResizePaneLeft, title: { value: localize('workbench.action.terminal.resizePaneLeft', "Resize Pane Left"), original: 'Resize Pane Left' }, f1: true, category, @@ -283,7 +283,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.ResizePaneRight, + id: TerminalCommandId.ResizePaneRight, title: { value: localize('workbench.action.terminal.resizePaneRight', "Resize Pane Right"), original: 'Resize Pane Right' }, f1: true, category, @@ -303,7 +303,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.ResizePaneUp, + id: TerminalCommandId.ResizePaneUp, title: { value: localize('workbench.action.terminal.resizePaneUp', "Resize Pane Up"), original: 'Resize Pane Up' }, f1: true, category, @@ -322,7 +322,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.ResizePaneDown, + id: TerminalCommandId.ResizePaneDown, title: { value: localize('workbench.action.terminal.resizePaneDown', "Resize Pane Down"), original: 'Resize Pane Down' }, f1: true, category, @@ -341,7 +341,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.Focus, + id: TerminalCommandId.Focus, title: { value: localize('workbench.action.terminal.focus', "Focus Terminal"), original: 'Focus Terminal' }, f1: true, category, @@ -353,20 +353,20 @@ export function registerTerminalActions() { order: 0, when: ContextKeyAndExpr.create([ ContextKeyEqualsExpr.create('view', TERMINAL_VIEW_ID), - ContextKeyExpr.has(`config.${TERMINAL_SETTING_ID.TabsEnabled}`), + ContextKeyExpr.has(`config.${TerminalSettingId.TabsEnabled}`), ContextKeyExpr.or( ContextKeyExpr.and( - ContextKeyExpr.equals(`config.${TERMINAL_SETTING_ID.TabsShowActiveTerminal}`, 'singleTerminal'), + ContextKeyExpr.equals(`config.${TerminalSettingId.TabsShowActiveTerminal}`, 'singleTerminal'), ContextKeyExpr.equals('terminalCount', 1) ), ContextKeyExpr.and( - ContextKeyExpr.equals(`config.${TERMINAL_SETTING_ID.TabsShowActiveTerminal}`, 'singleTerminalOrNarrow'), + ContextKeyExpr.equals(`config.${TerminalSettingId.TabsShowActiveTerminal}`, 'singleTerminalOrNarrow'), ContextKeyExpr.or( ContextKeyExpr.equals('terminalCount', 1), ContextKeyExpr.has('isTerminalTabsNarrow') ) ), - ContextKeyExpr.equals(`config.${TERMINAL_SETTING_ID.TabsShowActiveTerminal}`, 'always') + ContextKeyExpr.equals(`config.${TerminalSettingId.TabsShowActiveTerminal}`, 'always') ) ]), } @@ -385,7 +385,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.FocusTabs, + id: TerminalCommandId.FocusTabs, title: { value: localize('workbench.action.terminal.focus.tabsView', "Focus Terminal Tabs View"), original: 'Focus Terminal Tabs View' }, f1: true, category, @@ -404,7 +404,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.FocusNext, + id: TerminalCommandId.FocusNext, title: { value: localize('workbench.action.terminal.focusNext', "Focus Next Terminal"), original: 'Focus Next Terminal' }, f1: true, category, @@ -428,7 +428,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.FocusPrevious, + id: TerminalCommandId.FocusPrevious, title: { value: localize('workbench.action.terminal.focusPrevious', "Focus Previous Terminal"), original: 'Focus Previous Terminal' }, f1: true, category, @@ -452,7 +452,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.RunSelectedText, + id: TerminalCommandId.RunSelectedText, title: { value: localize('workbench.action.terminal.runSelectedText', "Run Selected Text In Active Terminal"), original: 'Run Selected Text In Active Terminal' }, f1: true, category, @@ -483,7 +483,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.RunActiveFile, + id: TerminalCommandId.RunActiveFile, title: { value: localize('workbench.action.terminal.runActiveFile', "Run Active File In Active Terminal"), original: 'Run Active File In Active Terminal' }, f1: true, category, @@ -516,7 +516,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.ScrollDownLine, + id: TerminalCommandId.ScrollDownLine, title: { value: localize('workbench.action.terminal.scrollDown', "Scroll Down (Line)"), original: 'Scroll Down (Line)' }, f1: true, category, @@ -536,7 +536,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.ScrollDownPage, + id: TerminalCommandId.ScrollDownPage, title: { value: localize('workbench.action.terminal.scrollDownPage', "Scroll Down (Page)"), original: 'Scroll Down (Page)' }, f1: true, category, @@ -556,7 +556,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.ScrollToBottom, + id: TerminalCommandId.ScrollToBottom, title: { value: localize('workbench.action.terminal.scrollToBottom', "Scroll to Bottom"), original: 'Scroll to Bottom' }, f1: true, category, @@ -576,7 +576,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.ScrollUpLine, + id: TerminalCommandId.ScrollUpLine, title: { value: localize('workbench.action.terminal.scrollUp', "Scroll Up (Line)"), original: 'Scroll Up (Line)' }, f1: true, category, @@ -596,7 +596,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.ScrollUpPage, + id: TerminalCommandId.ScrollUpPage, title: { value: localize('workbench.action.terminal.scrollUpPage', "Scroll Up (Page)"), original: 'Scroll Up (Page)' }, f1: true, category, @@ -616,7 +616,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.ScrollToTop, + id: TerminalCommandId.ScrollToTop, title: { value: localize('workbench.action.terminal.scrollToTop', "Scroll to Top"), original: 'Scroll to Top' }, f1: true, category, @@ -636,7 +636,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.NavigationModeExit, + id: TerminalCommandId.NavigationModeExit, title: { value: localize('workbench.action.terminal.navigationModeExit', "Exit Navigation Mode"), original: 'Exit Navigation Mode' }, f1: true, category, @@ -655,7 +655,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.NavigationModeFocusPrevious, + id: TerminalCommandId.NavigationModeFocusPrevious, title: { value: localize('workbench.action.terminal.navigationModeFocusPrevious', "Focus Previous Line (Navigation Mode)"), original: 'Focus Previous Line (Navigation Mode)' }, f1: true, category, @@ -677,7 +677,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.NavigationModeFocusNext, + id: TerminalCommandId.NavigationModeFocusNext, title: { value: localize('workbench.action.terminal.navigationModeFocusNext', "Focus Next Line (Navigation Mode)"), original: 'Focus Next Line (Navigation Mode)' }, f1: true, category, @@ -699,7 +699,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.ClearSelection, + id: TerminalCommandId.ClearSelection, title: { value: localize('workbench.action.terminal.clearSelection', "Clear Selection"), original: 'Clear Selection' }, f1: true, category, @@ -721,7 +721,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.ChangeIcon, + id: TerminalCommandId.ChangeIcon, title: { value: localize('workbench.action.terminal.changeIcon', "Change Icon..."), original: 'Change Icon...' }, f1: true, category, @@ -735,7 +735,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.ChangeIconInstance, + id: TerminalCommandId.ChangeIconInstance, title: { value: localize('workbench.action.terminal.changeIcon', "Change Icon..."), original: 'Change Icon...' }, f1: false, category, @@ -749,7 +749,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.Rename, + id: TerminalCommandId.Rename, title: { value: localize('workbench.action.terminal.rename', "Rename..."), original: 'Rename...' }, f1: true, category, @@ -763,7 +763,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.RenameInstance, + id: TerminalCommandId.RenameInstance, title: { value: localize('workbench.action.terminal.renameInstance', "Rename..."), original: 'Rename...' }, f1: false, category, @@ -785,7 +785,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.FindFocus, + id: TerminalCommandId.FindFocus, title: { value: localize('workbench.action.terminal.focusFind', "Focus Find"), original: 'Focus Find' }, f1: true, category, @@ -804,7 +804,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.FindHide, + id: TerminalCommandId.FindHide, title: { value: localize('workbench.action.terminal.hideFind', "Hide Find"), original: 'Hide Find' }, f1: true, category, @@ -824,7 +824,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.AttachToRemoteTerminal, + id: TerminalCommandId.AttachToRemoteTerminal, title: { value: localize('workbench.action.terminal.attachToRemote', "Attach to Session"), original: 'Attach to Session' }, f1: true, category @@ -867,7 +867,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.QuickOpenTerm, + id: TerminalCommandId.QuickOpenTerm, title: { value: localize('quickAccessTerminal', "Switch Active Terminal"), original: 'Switch Active Terminal' }, f1: true, category, @@ -881,7 +881,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.ScrollToPreviousCommand, + id: TerminalCommandId.ScrollToPreviousCommand, title: { value: localize('workbench.action.terminal.scrollToPreviousCommand', "Scroll To Previous Command"), original: 'Scroll To Previous Command' }, f1: true, category, @@ -903,7 +903,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.ScrollToNextCommand, + id: TerminalCommandId.ScrollToNextCommand, title: { value: localize('workbench.action.terminal.scrollToNextCommand', "Scroll To Next Command"), original: 'Scroll To Next Command' }, f1: true, category, @@ -925,7 +925,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.SelectToPreviousCommand, + id: TerminalCommandId.SelectToPreviousCommand, title: { value: localize('workbench.action.terminal.selectToPreviousCommand', "Select To Previous Command"), original: 'Select To Previous Command' }, f1: true, category, @@ -947,7 +947,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.SelectToNextCommand, + id: TerminalCommandId.SelectToNextCommand, title: { value: localize('workbench.action.terminal.selectToNextCommand', "Select To Next Command"), original: 'Select To Next Command' }, f1: true, category, @@ -969,7 +969,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.SelectToPreviousLine, + id: TerminalCommandId.SelectToPreviousLine, title: { value: localize('workbench.action.terminal.selectToPreviousLine', "Select To Previous Line"), original: 'Select To Previous Line' }, f1: true, category, @@ -986,7 +986,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.SelectToNextLine, + id: TerminalCommandId.SelectToNextLine, title: { value: localize('workbench.action.terminal.selectToNextLine', "Select To Next Line"), original: 'Select To Next Line' }, f1: true, category, @@ -1003,7 +1003,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.ToggleEscapeSequenceLogging, + id: TerminalCommandId.ToggleEscapeSequenceLogging, title: { value: localize('workbench.action.terminal.toggleEscapeSequenceLogging', "Toggle Escape Sequence Logging"), original: 'Toggle Escape Sequence Logging' }, f1: true, category, @@ -1018,7 +1018,7 @@ export function registerTerminalActions() { constructor() { const title = localize('workbench.action.terminal.sendSequence', "Send Custom Sequence To Terminal"); super({ - id: TERMINAL_COMMAND_ID.SendSequence, + id: TerminalCommandId.SendSequence, title: { value: title, original: 'Send Custom Sequence To Terminal' }, category, description: { @@ -1045,7 +1045,7 @@ export function registerTerminalActions() { constructor() { const title = localize('workbench.action.terminal.newWithCwd', "Create New Integrated Terminal Starting in a Custom Working Directory"); super({ - id: TERMINAL_COMMAND_ID.NewWithCwd, + id: TerminalCommandId.NewWithCwd, title: { value: title, original: 'Create New Integrated Terminal Starting in a Custom Working Directory' }, category, description: { @@ -1083,7 +1083,7 @@ export function registerTerminalActions() { constructor() { const title = localize('workbench.action.terminal.renameWithArg', "Rename the Currently Active Terminal"); super({ - id: TERMINAL_COMMAND_ID.RenameWithArgs, + id: TerminalCommandId.RenameWithArgs, title: { value: title, original: 'Rename the Currently Active Terminal' }, category, description: { @@ -1118,7 +1118,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.ToggleFindRegex, + id: TerminalCommandId.ToggleFindRegex, title: { value: localize('workbench.action.terminal.toggleFindRegex', "Toggle Find Using Regex"), original: 'Toggle Find Using Regex' }, f1: true, category, @@ -1139,7 +1139,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.ToggleFindWholeWord, + id: TerminalCommandId.ToggleFindWholeWord, title: { value: localize('workbench.action.terminal.toggleFindWholeWord', "Toggle Find Using Whole Word"), original: 'Toggle Find Using Whole Word' }, f1: true, category, @@ -1160,7 +1160,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.ToggleFindCaseSensitive, + id: TerminalCommandId.ToggleFindCaseSensitive, title: { value: localize('workbench.action.terminal.toggleFindCaseSensitive', "Toggle Find Using Case Sensitive"), original: 'Toggle Find Using Case Sensitive' }, f1: true, category, @@ -1181,7 +1181,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.FindNext, + id: TerminalCommandId.FindNext, title: { value: localize('workbench.action.terminal.findNext', "Find Next"), original: 'Find Next' }, f1: true, category, @@ -1208,7 +1208,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.FindPrevious, + id: TerminalCommandId.FindPrevious, title: { value: localize('workbench.action.terminal.findPrevious', "Find Previous"), original: 'Find Previous' }, f1: true, category, @@ -1235,7 +1235,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.SearchWorkspace, + id: TerminalCommandId.SearchWorkspace, title: { value: localize('workbench.action.terminal.searchWorkspace', "Search Workspace"), original: 'Search Workspace' }, f1: true, category, @@ -1257,7 +1257,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.Relaunch, + id: TerminalCommandId.Relaunch, title: { value: localize('workbench.action.terminal.relaunch', "Relaunch Active Terminal"), original: 'Relaunch Active Terminal' }, f1: true, category, @@ -1271,7 +1271,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.ShowEnvironmentInformation, + id: TerminalCommandId.ShowEnvironmentInformation, title: { value: localize('workbench.action.terminal.showEnvironmentInformation', "Show Environment Information"), original: 'Show Environment Information' }, f1: true, category, @@ -1285,7 +1285,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.Split, + id: TerminalCommandId.Split, title: { value: localize('workbench.action.terminal.split', "Split Terminal"), original: 'Split Terminal' }, f1: true, category, @@ -1326,7 +1326,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.SplitInstance, + id: TerminalCommandId.SplitInstance, title: { value: localize('workbench.action.terminal.split', "Split Terminal"), original: 'Split Terminal' }, f1: false, category, @@ -1356,7 +1356,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.SplitInActiveWorkspace, + id: TerminalCommandId.SplitInActiveWorkspace, title: { value: localize('workbench.action.terminal.splitInActiveWorkspace', "Split Terminal (In Active Workspace)"), original: 'Split Terminal (In Active Workspace)' }, f1: true, category, @@ -1375,7 +1375,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.SelectAll, + id: TerminalCommandId.SelectAll, title: { value: localize('workbench.action.terminal.selectAll', "Select All"), original: 'Select All' }, f1: true, category, @@ -1400,7 +1400,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.New, + id: TerminalCommandId.New, title: { value: localize('workbench.action.terminal.new', "Create New Integrated Terminal"), original: 'Create New Integrated Terminal' }, f1: true, category, @@ -1452,7 +1452,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.Kill, + id: TerminalCommandId.Kill, title: { value: localize('workbench.action.terminal.kill', "Kill the Active Terminal Instance"), original: 'Kill the Active Terminal Instance' }, f1: true, category, @@ -1464,7 +1464,7 @@ export function registerTerminalActions() { order: 3, when: ContextKeyAndExpr.create([ ContextKeyEqualsExpr.create('view', TERMINAL_VIEW_ID), - ContextKeyExpr.not(`config.${TERMINAL_SETTING_ID.TabsEnabled}`) + ContextKeyExpr.not(`config.${TerminalSettingId.TabsEnabled}`) ]) } }); @@ -1483,7 +1483,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.KillInstance, + id: TerminalCommandId.KillInstance, title: { value: localize('workbench.action.terminal.kill.short', "Kill Terminal"), original: 'Kill Terminal' }, @@ -1513,7 +1513,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.Clear, + id: TerminalCommandId.Clear, title: { value: localize('workbench.action.terminal.clear', "Clear"), original: 'Clear' }, f1: true, category, @@ -1538,7 +1538,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.SelectDefaultProfile, + id: TerminalCommandId.SelectDefaultProfile, title: { value: localize('workbench.action.terminal.selectDefaultProfile', "Select Default Profile"), original: 'Select Default Profile' }, f1: true, category, @@ -1553,8 +1553,8 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.CreateWithProfileButton, - title: TERMINAL_COMMAND_ID.CreateWithProfileButton, + id: TerminalCommandId.CreateWithProfileButton, + title: TerminalCommandId.CreateWithProfileButton, f1: false, category, precondition: KEYBINDING_CONTEXT_TERMINAL_PROCESS_SUPPORTED, @@ -1575,7 +1575,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.ConfigureTerminalSettings, + id: TerminalCommandId.ConfigureTerminalSettings, title: { value: localize('workbench.action.terminal.openSettings', "Configure Terminal Settings"), original: 'Configure Terminal Settings' }, f1: true, category, @@ -1592,7 +1592,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.CopySelection, + id: TerminalCommandId.CopySelection, title: { value: localize('workbench.action.terminal.copySelection', "Copy Selection"), original: 'Copy Selection' }, f1: true, category, @@ -1617,7 +1617,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.Paste, + id: TerminalCommandId.Paste, title: { value: localize('workbench.action.terminal.paste', "Paste into Active Terminal"), original: 'Paste into Active Terminal' }, f1: true, category, @@ -1641,7 +1641,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.PasteSelection, + id: TerminalCommandId.PasteSelection, title: { value: localize('workbench.action.terminal.pasteSelection', "Paste Selection into Active Terminal"), original: 'Paste Selection into Active Terminal' }, f1: true, category, @@ -1663,7 +1663,7 @@ export function registerTerminalActions() { registerAction2(class extends Action2 { constructor() { super({ - id: TERMINAL_COMMAND_ID.SwitchTerminal, + id: TerminalCommandId.SwitchTerminal, title: switchTerminalTitle, f1: true, category, @@ -1682,7 +1682,7 @@ export function registerTerminalActions() { return Promise.resolve(null); } if (item === switchTerminalShowTabsTitle) { - accessor.get(IConfigurationService).updateValue(TERMINAL_SETTING_ID.TabsEnabled, true); + accessor.get(IConfigurationService).updateValue(TerminalSettingId.TabsEnabled, true); return; } const indexMatches = terminalIndexRe.exec(item); diff --git a/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts b/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts index 2b515588e2849..b94747f56b7d6 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts @@ -24,7 +24,7 @@ import { activeContrastBorder, scrollbarSliderActiveBackground, scrollbarSliderB import { ICssStyleCollector, IColorTheme, IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService'; import { PANEL_BACKGROUND, SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme'; import { TerminalWidgetManager } from 'vs/workbench/contrib/terminal/browser/widgets/widgetManager'; -import { ITerminalProcessManager, KEYBINDING_CONTEXT_TERMINAL_TEXT_SELECTED, NEVER_MEASURE_RENDER_TIME_STORAGE_KEY, ProcessState, TERMINAL_VIEW_ID, KEYBINDING_CONTEXT_TERMINAL_A11Y_TREE_FOCUS, INavigationMode, TitleEventSource, DEFAULT_COMMANDS_TO_SKIP_SHELL, TERMINAL_CREATION_COMMANDS, KEYBINDING_CONTEXT_TERMINAL_ALT_BUFFER_ACTIVE, SUGGESTED_RENDERER_TYPE, ITerminalProfileResolverService, TERMINAL_SETTING_ID } from 'vs/workbench/contrib/terminal/common/terminal'; +import { ITerminalProcessManager, KEYBINDING_CONTEXT_TERMINAL_TEXT_SELECTED, NEVER_MEASURE_RENDER_TIME_STORAGE_KEY, ProcessState, TERMINAL_VIEW_ID, KEYBINDING_CONTEXT_TERMINAL_A11Y_TREE_FOCUS, INavigationMode, TitleEventSource, DEFAULT_COMMANDS_TO_SKIP_SHELL, TERMINAL_CREATION_COMMANDS, KEYBINDING_CONTEXT_TERMINAL_ALT_BUFFER_ACTIVE, SUGGESTED_RENDERER_TYPE, ITerminalProfileResolverService, TerminalSettingId } from 'vs/workbench/contrib/terminal/common/terminal'; import { ansiColorIdentifiers, TERMINAL_BACKGROUND_COLOR, TERMINAL_CURSOR_BACKGROUND_COLOR, TERMINAL_CURSOR_FOREGROUND_COLOR, TERMINAL_FOREGROUND_COLOR, TERMINAL_SELECTION_BACKGROUND_COLOR } from 'vs/workbench/contrib/terminal/common/terminalColorRegistry'; import { TerminalConfigHelper } from 'vs/workbench/contrib/terminal/browser/terminalConfigHelper'; import { TerminalLinkManager } from 'vs/workbench/contrib/terminal/browser/links/terminalLinkManager'; @@ -290,13 +290,13 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { // supported. this.setVisible(this._isVisible); } - if (e.affectsConfiguration(TERMINAL_SETTING_ID.UnicodeVersion)) { + if (e.affectsConfiguration(TerminalSettingId.UnicodeVersion)) { this._updateUnicodeVersion(); } if (e.affectsConfiguration('editor.accessibilitySupport')) { this.updateAccessibilitySupport(); } - if (e.affectsConfiguration(TERMINAL_SETTING_ID.GpuAcceleration)) { + if (e.affectsConfiguration(TerminalSettingId.GpuAcceleration)) { this._storageService.remove(SUGGESTED_RENDERER_TYPE, StorageScope.GLOBAL); } })); @@ -660,7 +660,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { { label: nls.localize('configureTerminalSettings', "Configure Terminal Settings"), run: () => { - this._preferencesService.openSettings(false, `@id:${TERMINAL_SETTING_ID.CommandsToSkipShell},${TERMINAL_SETTING_ID.SendKeybindingsToShell},${TERMINAL_SETTING_ID.AllowChords}`); + this._preferencesService.openSettings(false, `@id:${TerminalSettingId.CommandsToSkipShell},${TerminalSettingId.SendKeybindingsToShell},${TerminalSettingId.AllowChords}`); } } as IPromptChoice ] @@ -761,7 +761,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { const promptChoices: IPromptChoice[] = [ { label: nls.localize('yes', "Yes"), - run: () => this._configurationService.updateValue(TERMINAL_SETTING_ID.GpuAcceleration, 'off', ConfigurationTarget.USER) + run: () => this._configurationService.updateValue(TerminalSettingId.GpuAcceleration, 'off', ConfigurationTarget.USER) } as IPromptChoice, { label: nls.localize('no', "No"), @@ -1135,7 +1135,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { } } - if (this._processManager.processState === ProcessState.KILLED_DURING_LAUNCH) { + if (this._processManager.processState === ProcessState.KilledDuringLaunch) { if (commandLine) { exitCodeMessage = nls.localize('launchFailed.exitCodeAndCommandLine', "The terminal process \"{0}\" failed to launch (exit code: {1}).", commandLine, this._exitCode); break; @@ -1159,7 +1159,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { // Only trigger wait on exit when the exit was *not* triggered by the // user (via the `workbench.action.terminal.kill` command). - if (this._shellLaunchConfig.waitOnExit && this._processManager.processState !== ProcessState.KILLED_BY_USER) { + if (this._shellLaunchConfig.waitOnExit && this._processManager.processState !== ProcessState.KilledByUser) { this._xtermReadyPromise.then(xterm => { if (exitCodeMessage) { xterm.writeln(exitCodeMessage); @@ -1176,7 +1176,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { } else { this.dispose(); if (exitCodeMessage) { - const failedDuringLaunch = this._processManager.processState === ProcessState.KILLED_DURING_LAUNCH; + const failedDuringLaunch = this._processManager.processState === ProcessState.KilledDuringLaunch; if (failedDuringLaunch || this._configHelper.config.showExitAlert) { // Always show launch failures this._notificationService.notify({ @@ -1324,7 +1324,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { } private async _onSelectionChange(): Promise { - if (this._configurationService.getValue(TERMINAL_SETTING_ID.CopyOnSelection)) { + if (this._configurationService.getValue(TerminalSettingId.CopyOnSelection)) { if (this.hasSelection()) { await this.copySelection(); } diff --git a/src/vs/workbench/contrib/terminal/browser/terminalMenus.ts b/src/vs/workbench/contrib/terminal/browser/terminalMenus.ts index cb0911e44547b..2b6df3689751f 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalMenus.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalMenus.ts @@ -6,7 +6,7 @@ import { localize } from 'vs/nls'; import { MenuRegistry, MenuId } from 'vs/platform/actions/common/actions'; import { ContextKeyAndExpr, ContextKeyEqualsExpr, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; -import { KEYBINDING_CONTEXT_TERMINAL_PROCESS_SUPPORTED, TERMINAL_COMMAND_ID, TERMINAL_SETTING_ID, TERMINAL_VIEW_ID } from 'vs/workbench/contrib/terminal/common/terminal'; +import { KEYBINDING_CONTEXT_TERMINAL_PROCESS_SUPPORTED, TerminalCommandId, TerminalSettingId, TERMINAL_VIEW_ID } from 'vs/workbench/contrib/terminal/common/terminal'; const enum ContextMenuGroup { Create = '1_create', @@ -36,7 +36,7 @@ export function setupTerminalMenus(): void { id: MenuId.MenubarTerminalMenu, item: { group: TerminalMenuBarGroup.Create, command: { - id: TERMINAL_COMMAND_ID.New, + id: TerminalCommandId.New, title: localize({ key: 'miNewTerminal', comment: ['&& denotes a mnemonic'] }, "&&New Terminal") }, order: 1 @@ -46,7 +46,7 @@ export function setupTerminalMenus(): void { id: MenuId.MenubarTerminalMenu, item: { group: TerminalMenuBarGroup.Create, command: { - id: TERMINAL_COMMAND_ID.Split, + id: TerminalCommandId.Split, title: localize({ key: 'miSplitTerminal', comment: ['&& denotes a mnemonic'] }, "&&Split Terminal"), precondition: ContextKeyExpr.has('terminalIsOpen') }, @@ -58,7 +58,7 @@ export function setupTerminalMenus(): void { id: MenuId.MenubarTerminalMenu, item: { group: TerminalMenuBarGroup.Run, command: { - id: TERMINAL_COMMAND_ID.RunActiveFile, + id: TerminalCommandId.RunActiveFile, title: localize({ key: 'miRunActiveFile', comment: ['&& denotes a mnemonic'] }, "Run &&Active File") }, order: 3, @@ -69,7 +69,7 @@ export function setupTerminalMenus(): void { id: MenuId.MenubarTerminalMenu, item: { group: TerminalMenuBarGroup.Run, command: { - id: TERMINAL_COMMAND_ID.RunSelectedText, + id: TerminalCommandId.RunSelectedText, title: localize({ key: 'miRunSelectedText', comment: ['&& denotes a mnemonic'] }, "Run &&Selected Text") }, order: 4, @@ -85,7 +85,7 @@ export function setupTerminalMenus(): void { id: MenuId.TerminalInstanceContext, item: { group: ContextMenuGroup.Create, command: { - id: TERMINAL_COMMAND_ID.Split, + id: TerminalCommandId.Split, title: localize('workbench.action.terminal.split', "Split Terminal") } } @@ -93,7 +93,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalInstanceContext, item: { command: { - id: TERMINAL_COMMAND_ID.New, + id: TerminalCommandId.New, title: localize('workbench.action.terminal.new.short', "New Terminal") }, group: ContextMenuGroup.Create @@ -102,7 +102,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalInstanceContext, item: { command: { - id: TERMINAL_COMMAND_ID.Kill, + id: TerminalCommandId.Kill, title: localize('workbench.action.terminal.kill.short', "Kill Terminal") }, group: ContextMenuGroup.Kill @@ -111,7 +111,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalInstanceContext, item: { command: { - id: TERMINAL_COMMAND_ID.CopySelection, + id: TerminalCommandId.CopySelection, title: localize('workbench.action.terminal.copySelection.short', "Copy") }, group: ContextMenuGroup.Edit, @@ -121,7 +121,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalInstanceContext, item: { command: { - id: TERMINAL_COMMAND_ID.Paste, + id: TerminalCommandId.Paste, title: localize('workbench.action.terminal.paste.short', "Paste") }, group: ContextMenuGroup.Edit, @@ -131,7 +131,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalInstanceContext, item: { command: { - id: TERMINAL_COMMAND_ID.Clear, + id: TerminalCommandId.Clear, title: localize('workbench.action.terminal.clear', "Clear") }, group: ContextMenuGroup.Clear, @@ -140,17 +140,17 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalInstanceContext, item: { command: { - id: TERMINAL_COMMAND_ID.ShowTabs, + id: TerminalCommandId.ShowTabs, title: localize('workbench.action.terminal.showsTabs', "Show Tabs") }, - when: ContextKeyExpr.not(`config.${TERMINAL_SETTING_ID.TabsEnabled}`), + when: ContextKeyExpr.not(`config.${TerminalSettingId.TabsEnabled}`), group: ContextMenuGroup.Config } }, { id: MenuId.TerminalInstanceContext, item: { command: { - id: TERMINAL_COMMAND_ID.SelectAll, + id: TerminalCommandId.SelectAll, title: localize('workbench.action.terminal.selectAll', "Select All"), }, group: ContextMenuGroup.Edit, @@ -165,7 +165,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalTabEmptyAreaContext, item: { command: { - id: TERMINAL_COMMAND_ID.NewWithProfile, + id: TerminalCommandId.NewWithProfile, title: localize('workbench.action.terminal.newWithProfile.short', "New Terminal With Profile") }, group: ContextMenuGroup.Create @@ -174,7 +174,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalTabEmptyAreaContext, item: { command: { - id: TERMINAL_COMMAND_ID.New, + id: TerminalCommandId.New, title: localize('workbench.action.terminal.new.short', "New Terminal") }, group: ContextMenuGroup.Create @@ -188,7 +188,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalNewDropdownContext, item: { command: { - id: TERMINAL_COMMAND_ID.SelectDefaultProfile, + id: TerminalCommandId.SelectDefaultProfile, title: { value: localize('workbench.action.terminal.selectDefaultProfile', "Select Default Profile"), original: 'Select Default Profile' } }, group: TerminalTabContextMenuGroup.Configure @@ -197,7 +197,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalNewDropdownContext, item: { command: { - id: TERMINAL_COMMAND_ID.ConfigureTerminalSettings, + id: TerminalCommandId.ConfigureTerminalSettings, title: localize('workbench.action.terminal.openSettings', "Configure Terminal Settings") }, group: TerminalTabContextMenuGroup.Configure @@ -212,27 +212,27 @@ export function setupTerminalMenus(): void { id: MenuId.ViewTitle, item: { group: 'navigation', command: { - id: TERMINAL_COMMAND_ID.Split, + id: TerminalCommandId.Split, title: localize('workbench.action.terminal.split', "Split Terminal") }, order: 2, when: ContextKeyAndExpr.create([ ContextKeyEqualsExpr.create('view', TERMINAL_VIEW_ID), - ContextKeyExpr.not(`config.${TERMINAL_SETTING_ID.TabsEnabled}`) + ContextKeyExpr.not(`config.${TerminalSettingId.TabsEnabled}`) ]) } }, { id: MenuId.ViewTitle, item: { command: { - id: TERMINAL_COMMAND_ID.SwitchTerminal, + id: TerminalCommandId.SwitchTerminal, title: { value: localize('workbench.action.terminal.switchTerminal', "Switch Terminal"), original: 'Switch Terminal' } }, group: 'navigation', order: 0, when: ContextKeyAndExpr.create([ ContextKeyEqualsExpr.create('view', TERMINAL_VIEW_ID), - ContextKeyExpr.not(`config.${TERMINAL_SETTING_ID.TabsEnabled}`) + ContextKeyExpr.not(`config.${TerminalSettingId.TabsEnabled}`) ]), } } @@ -244,7 +244,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalInlineTabContext, item: { command: { - id: TERMINAL_COMMAND_ID.ChangeIcon, + id: TerminalCommandId.ChangeIcon, title: localize('workbench.action.terminal.changeIcon', "Change Icon...") }, group: ContextMenuGroup.Edit, @@ -254,7 +254,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalInlineTabContext, item: { command: { - id: TERMINAL_COMMAND_ID.Rename, + id: TerminalCommandId.Rename, title: localize('workbench.action.terminal.rename', "Rename...") } } @@ -262,7 +262,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalInlineTabContext, item: { command: { - id: TERMINAL_COMMAND_ID.RenameInstance, + id: TerminalCommandId.RenameInstance, title: localize('workbench.action.terminal.renameInstance', "Rename...") }, group: ContextMenuGroup.Edit @@ -272,7 +272,7 @@ export function setupTerminalMenus(): void { id: MenuId.TerminalInlineTabContext, item: { group: ContextMenuGroup.Create, command: { - id: TERMINAL_COMMAND_ID.Split, + id: TerminalCommandId.Split, title: localize('workbench.action.terminal.split', "Split Terminal") } } @@ -280,7 +280,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalInlineTabContext, item: { command: { - id: TERMINAL_COMMAND_ID.Kill, + id: TerminalCommandId.Kill, title: localize('workbench.action.terminal.kill.short', "Kill Terminal") }, group: ContextMenuGroup.Kill @@ -294,7 +294,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalTabContext, item: { command: { - id: TERMINAL_COMMAND_ID.RenameInstance, + id: TerminalCommandId.RenameInstance, title: localize('workbench.action.terminal.renameInstance', "Rename...") }, group: ContextMenuGroup.Edit @@ -303,7 +303,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalTabContext, item: { command: { - id: TERMINAL_COMMAND_ID.ChangeIconInstance, + id: TerminalCommandId.ChangeIconInstance, title: localize('workbench.action.terminal.changeIcon', "Change Icon...") }, group: ContextMenuGroup.Edit @@ -312,7 +312,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalTabContext, item: { command: { - id: TERMINAL_COMMAND_ID.SplitInstance, + id: TerminalCommandId.SplitInstance, title: localize('workbench.action.terminal.splitInstance', "Split Terminal"), }, group: ContextMenuGroup.Create @@ -321,7 +321,7 @@ export function setupTerminalMenus(): void { { id: MenuId.TerminalTabContext, item: { command: { - id: TERMINAL_COMMAND_ID.KillInstance, + id: TerminalCommandId.KillInstance, title: localize('workbench.action.terminal.killInstance', "Kill Terminal") }, group: ContextMenuGroup.Kill, diff --git a/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.ts b/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.ts index e5dae8ec91b00..f2c337485b5e5 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as terminalEnvironment from 'vs/workbench/contrib/terminal/common/terminalEnvironment'; -import { ProcessState, ITerminalProcessManager, ITerminalConfigHelper, IBeforeProcessDataEvent, ITerminalProfileResolverService, ITerminalConfiguration, TERMINAL_CONFIG_SECTION, TERMINAL_SETTING_ID } from 'vs/workbench/contrib/terminal/common/terminal'; +import { ProcessState, ITerminalProcessManager, ITerminalConfigHelper, IBeforeProcessDataEvent, ITerminalProfileResolverService, ITerminalConfiguration, TERMINAL_CONFIG_SECTION, TerminalSettingId } from 'vs/workbench/contrib/terminal/common/terminal'; import { ILogService } from 'vs/platform/log/common/log'; import { Emitter, Event } from 'vs/base/common/event'; import { IHistoryService } from 'vs/workbench/services/history/common/history'; @@ -52,7 +52,7 @@ enum ProcessType { * - Shell Process: The pseudoterminal child process (ie. the shell) */ export class TerminalProcessManager extends Disposable implements ITerminalProcessManager { - public processState: ProcessState = ProcessState.UNINITIALIZED; + public processState: ProcessState = ProcessState.Uninitialized; public ptyProcessReady: Promise; public shellProcessId: number | undefined; public remoteAuthority: string | undefined; @@ -152,7 +152,7 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce // If the process was still connected this dispose came from // within VS Code, not the process, so mark the process as // killed by the user. - this.processState = ProcessState.KILLED_BY_USER; + this.processState = ProcessState.KilledByUser; this._process.shutdown(immediate); this._process = null; } @@ -238,19 +238,19 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce }); const terminalConfig = this._configurationService.getValue(TERMINAL_CONFIG_SECTION); const configuration: ICompleteTerminalConfiguration = { - 'terminal.integrated.automationShell.windows': this._terminalProfileResolverService.getSafeConfigValueFullKey(TERMINAL_SETTING_ID.AutomationShellWindows) as string, - 'terminal.integrated.automationShell.osx': this._terminalProfileResolverService.getSafeConfigValueFullKey(TERMINAL_SETTING_ID.AutomationShellMacOs) as string, - 'terminal.integrated.automationShell.linux': this._terminalProfileResolverService.getSafeConfigValueFullKey(TERMINAL_SETTING_ID.AutomationShellLinux) as string, - 'terminal.integrated.shell.windows': this._terminalProfileResolverService.getSafeConfigValueFullKey(TERMINAL_SETTING_ID.ShellWindows) as string, - 'terminal.integrated.shell.osx': this._terminalProfileResolverService.getSafeConfigValueFullKey(TERMINAL_SETTING_ID.ShellMacOs) as string, - 'terminal.integrated.shell.linux': this._terminalProfileResolverService.getSafeConfigValueFullKey(TERMINAL_SETTING_ID.ShellLinux) as string, - 'terminal.integrated.shellArgs.windows': this._terminalProfileResolverService.getSafeConfigValueFullKey(TERMINAL_SETTING_ID.ShellArgsWindows) as string | string[], - 'terminal.integrated.shellArgs.osx': this._terminalProfileResolverService.getSafeConfigValueFullKey(TERMINAL_SETTING_ID.ShellArgsMacOs) as string | string[], - 'terminal.integrated.shellArgs.linux': this._terminalProfileResolverService.getSafeConfigValueFullKey(TERMINAL_SETTING_ID.ShellArgsLinux) as string | string[], - 'terminal.integrated.env.windows': this._terminalProfileResolverService.getSafeConfigValueFullKey(TERMINAL_SETTING_ID.EnvWindows) as ITerminalEnvironment, - 'terminal.integrated.env.osx': this._terminalProfileResolverService.getSafeConfigValueFullKey(TERMINAL_SETTING_ID.EnvMacOs) as ITerminalEnvironment, - 'terminal.integrated.env.linux': this._terminalProfileResolverService.getSafeConfigValueFullKey(TERMINAL_SETTING_ID.EnvLinux) as ITerminalEnvironment, - 'terminal.integrated.cwd': this._terminalProfileResolverService.getSafeConfigValueFullKey(TERMINAL_SETTING_ID.Cwd) as string, + 'terminal.integrated.automationShell.windows': this._terminalProfileResolverService.getSafeConfigValueFullKey(TerminalSettingId.AutomationShellWindows) as string, + 'terminal.integrated.automationShell.osx': this._terminalProfileResolverService.getSafeConfigValueFullKey(TerminalSettingId.AutomationShellMacOs) as string, + 'terminal.integrated.automationShell.linux': this._terminalProfileResolverService.getSafeConfigValueFullKey(TerminalSettingId.AutomationShellLinux) as string, + 'terminal.integrated.shell.windows': this._terminalProfileResolverService.getSafeConfigValueFullKey(TerminalSettingId.ShellWindows) as string, + 'terminal.integrated.shell.osx': this._terminalProfileResolverService.getSafeConfigValueFullKey(TerminalSettingId.ShellMacOs) as string, + 'terminal.integrated.shell.linux': this._terminalProfileResolverService.getSafeConfigValueFullKey(TerminalSettingId.ShellLinux) as string, + 'terminal.integrated.shellArgs.windows': this._terminalProfileResolverService.getSafeConfigValueFullKey(TerminalSettingId.ShellArgsWindows) as string | string[], + 'terminal.integrated.shellArgs.osx': this._terminalProfileResolverService.getSafeConfigValueFullKey(TerminalSettingId.ShellArgsMacOs) as string | string[], + 'terminal.integrated.shellArgs.linux': this._terminalProfileResolverService.getSafeConfigValueFullKey(TerminalSettingId.ShellArgsLinux) as string | string[], + 'terminal.integrated.env.windows': this._terminalProfileResolverService.getSafeConfigValueFullKey(TerminalSettingId.EnvWindows) as ITerminalEnvironment, + 'terminal.integrated.env.osx': this._terminalProfileResolverService.getSafeConfigValueFullKey(TerminalSettingId.EnvMacOs) as ITerminalEnvironment, + 'terminal.integrated.env.linux': this._terminalProfileResolverService.getSafeConfigValueFullKey(TerminalSettingId.EnvLinux) as ITerminalEnvironment, + 'terminal.integrated.cwd': this._terminalProfileResolverService.getSafeConfigValueFullKey(TerminalSettingId.Cwd) as string, 'terminal.integrated.detectLocale': terminalConfig.detectLocale }; newProcess = await this._remoteTerminalService.createProcess(shellLaunchConfig, configuration, activeWorkspaceRootUri, cols, rows, shouldPersist, this._configHelper); @@ -288,7 +288,7 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce this._process = newProcess; - this.processState = ProcessState.LAUNCHING; + this.processState = ProcessState.Launching; this._dataFilter.newProcess(this._process, reset); @@ -319,8 +319,8 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce } setTimeout(() => { - if (this.processState === ProcessState.LAUNCHING) { - this.processState = ProcessState.RUNNING; + if (this.processState === ProcessState.Launching) { + this.processState = ProcessState.Running; } }, LAUNCHING_DURATION); @@ -541,14 +541,14 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce // If the process is marked as launching then mark the process as killed // during launch. This typically means that there is a problem with the // shell and args. - if (this.processState === ProcessState.LAUNCHING) { - this.processState = ProcessState.KILLED_DURING_LAUNCH; + if (this.processState === ProcessState.Launching) { + this.processState = ProcessState.KilledDuringLaunch; } // If TerminalInstance did not know about the process exit then it was // triggered by the process, not on VS Code's side. - if (this.processState === ProcessState.RUNNING) { - this.processState = ProcessState.KILLED_BY_PROCESS; + if (this.processState === ProcessState.Running) { + this.processState = ProcessState.KilledByProcess; } this._onProcessExit.fire(exitCode); diff --git a/src/vs/workbench/contrib/terminal/browser/terminalProfileResolverService.ts b/src/vs/workbench/contrib/terminal/browser/terminalProfileResolverService.ts index ace09cd7c445d..6edaaabd893a5 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalProfileResolverService.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalProfileResolverService.ts @@ -14,7 +14,7 @@ import { IConfigurationResolverService } from 'vs/workbench/services/configurati import { IHistoryService } from 'vs/workbench/services/history/common/history'; import { IProcessEnvironment, OperatingSystem } from 'vs/base/common/platform'; import { IShellLaunchConfig } from 'vs/platform/terminal/common/terminal'; -import { IShellLaunchConfigResolveOptions, ITerminalProfile, ITerminalProfileResolverService, TERMINAL_SETTING_ID } from 'vs/workbench/contrib/terminal/common/terminal'; +import { IShellLaunchConfigResolveOptions, ITerminalProfile, ITerminalProfileResolverService, TerminalSettingId } from 'vs/workbench/contrib/terminal/common/terminal'; import * as path from 'vs/base/common/path'; import { Codicon, iconRegistry } from 'vs/base/common/codicons'; @@ -280,7 +280,7 @@ export abstract class BaseTerminalProfileResolverService implements ITerminalPro return this.getSafeConfigValueFullKey(`terminal.integrated.${key}.${this._getOsKey(os)}`); } getSafeConfigValueFullKey(key: string): unknown | undefined { - const isWorkspaceConfigAllowed = this._configurationService.getValue(TERMINAL_SETTING_ID.AllowWorkspaceConfiguration); + const isWorkspaceConfigAllowed = this._configurationService.getValue(TerminalSettingId.AllowWorkspaceConfiguration); if (isWorkspaceConfigAllowed) { return this._configurationService.getValue(key); } else { diff --git a/src/vs/workbench/contrib/terminal/browser/terminalQuickAccess.ts b/src/vs/workbench/contrib/terminal/browser/terminalQuickAccess.ts index 0504f0979dc65..49b977ff52420 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalQuickAccess.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalQuickAccess.ts @@ -9,7 +9,7 @@ import { IPickerQuickAccessItem, PickerQuickAccessProvider, TriggerAction } from import { matchesFuzzy } from 'vs/base/common/filters'; import { ITerminalService } from 'vs/workbench/contrib/terminal/browser/terminal'; import { ICommandService } from 'vs/platform/commands/common/commands'; -import { TERMINAL_COMMAND_ID } from 'vs/workbench/contrib/terminal/common/terminal'; +import { TerminalCommandId } from 'vs/workbench/contrib/terminal/common/terminal'; import { ThemeIcon } from 'vs/platform/theme/common/themeService'; import { killTerminalIcon, renameTerminalIcon } from 'vs/workbench/contrib/terminal/browser/terminalIcons'; @@ -52,7 +52,7 @@ export class TerminalQuickAccessProvider extends PickerQuickAccessProvider { switch (buttonIndex) { case 0: - this._commandService.executeCommand(TERMINAL_COMMAND_ID.Rename, terminal); + this._commandService.executeCommand(TerminalCommandId.Rename, terminal); return TriggerAction.NO_ACTION; case 1: terminal.dispose(true); @@ -78,13 +78,13 @@ export class TerminalQuickAccessProvider extends PickerQuickAccessProvider this._commandService.executeCommand(TERMINAL_COMMAND_ID.New) + accept: () => this._commandService.executeCommand(TerminalCommandId.New) }); const createWithProfileLabel = localize("workbench.action.terminal.newWithProfilePlus", "Create New Terminal With Profile"); terminalPicks.push({ label: `$(plus) ${createWithProfileLabel}`, ariaLabel: createWithProfileLabel, - accept: () => this._commandService.executeCommand(TERMINAL_COMMAND_ID.NewWithProfile) + accept: () => this._commandService.executeCommand(TerminalCommandId.NewWithProfile) }); return terminalPicks; diff --git a/src/vs/workbench/contrib/terminal/browser/terminalService.ts b/src/vs/workbench/contrib/terminal/browser/terminalService.ts index 947ef726bce7a..7d3fcfe01da9a 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalService.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalService.ts @@ -25,7 +25,7 @@ import { TerminalConfigHelper } from 'vs/workbench/contrib/terminal/browser/term import { TerminalInstance } from 'vs/workbench/contrib/terminal/browser/terminalInstance'; import { TerminalTab } from 'vs/workbench/contrib/terminal/browser/terminalTab'; import { TerminalViewPane } from 'vs/workbench/contrib/terminal/browser/terminalView'; -import { IAvailableProfilesRequest, IRemoteTerminalAttachTarget, ITerminalProfile, IStartExtensionTerminalRequest, ITerminalConfigHelper, ITerminalProcessExtHostProxy, KEYBINDING_CONTEXT_TERMINAL_ALT_BUFFER_ACTIVE, KEYBINDING_CONTEXT_TERMINAL_FOCUS, KEYBINDING_CONTEXT_TERMINAL_IS_OPEN, KEYBINDING_CONTEXT_TERMINAL_PROCESS_SUPPORTED, KEYBINDING_CONTEXT_TERMINAL_SHELL_TYPE, TERMINAL_VIEW_ID, ITerminalProfileObject, ITerminalTypeContribution, KEYBINDING_CONTEXT_TERMINAL_COUNT, TERMINAL_SETTING_ID } from 'vs/workbench/contrib/terminal/common/terminal'; +import { IAvailableProfilesRequest, IRemoteTerminalAttachTarget, ITerminalProfile, IStartExtensionTerminalRequest, ITerminalConfigHelper, ITerminalProcessExtHostProxy, KEYBINDING_CONTEXT_TERMINAL_ALT_BUFFER_ACTIVE, KEYBINDING_CONTEXT_TERMINAL_FOCUS, KEYBINDING_CONTEXT_TERMINAL_IS_OPEN, KEYBINDING_CONTEXT_TERMINAL_PROCESS_SUPPORTED, KEYBINDING_CONTEXT_TERMINAL_SHELL_TYPE, TERMINAL_VIEW_ID, ITerminalProfileObject, ITerminalTypeContribution, KEYBINDING_CONTEXT_TERMINAL_COUNT, TerminalSettingId } from 'vs/workbench/contrib/terminal/common/terminal'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService'; @@ -173,13 +173,13 @@ export class TerminalService implements ITerminalService { this._processSupportContextKey.set(!isWeb || this._remoteAgentService.getConnection() !== null); this._configurationService.onDidChangeConfiguration(async e => { - if (e.affectsConfiguration(TERMINAL_SETTING_ID.ProfilesWindows) || - e.affectsConfiguration(TERMINAL_SETTING_ID.ProfilesMacOs) || - e.affectsConfiguration(TERMINAL_SETTING_ID.ProfilesLinux) || - e.affectsConfiguration(TERMINAL_SETTING_ID.DefaultProfileWindows) || - e.affectsConfiguration(TERMINAL_SETTING_ID.DefaultProfileMacOs) || - e.affectsConfiguration(TERMINAL_SETTING_ID.DefaultProfileLinux) || - e.affectsConfiguration(TERMINAL_SETTING_ID.UseWslProfiles)) { + if (e.affectsConfiguration(TerminalSettingId.ProfilesWindows) || + e.affectsConfiguration(TerminalSettingId.ProfilesMacOs) || + e.affectsConfiguration(TerminalSettingId.ProfilesLinux) || + e.affectsConfiguration(TerminalSettingId.DefaultProfileWindows) || + e.affectsConfiguration(TerminalSettingId.DefaultProfileMacOs) || + e.affectsConfiguration(TerminalSettingId.DefaultProfileLinux) || + e.affectsConfiguration(TerminalSettingId.UseWslProfiles)) { this._refreshAvailableProfiles(); } }); @@ -705,7 +705,7 @@ export class TerminalService implements ITerminalService { } public showTabs() { - this._configurationService.updateValue(TERMINAL_SETTING_ID.TabsEnabled, true); + this._configurationService.updateValue(TerminalSettingId.TabsEnabled, true); } private _getIndexFromId(terminalId: number): number { diff --git a/src/vs/workbench/contrib/terminal/browser/terminalTabbedView.ts b/src/vs/workbench/contrib/terminal/browser/terminalTabbedView.ts index 7cbc200621556..31d2f3904cd1e 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalTabbedView.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalTabbedView.ts @@ -23,7 +23,7 @@ import { Action, IAction, Separator } from 'vs/base/common/actions'; import { IMenu, IMenuService, MenuId } from 'vs/platform/actions/common/actions'; import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; -import { KEYBINDING_CONTEXT_TERMINAL_FIND_VISIBLE, KEYBINDING_CONTEXT_TERMINAL_IS_TABS_NARROW_FOCUS, KEYBINDING_CONTEXT_TERMINAL_TABS_FOCUS, TERMINAL_SETTING_ID } from 'vs/workbench/contrib/terminal/common/terminal'; +import { KEYBINDING_CONTEXT_TERMINAL_FIND_VISIBLE, KEYBINDING_CONTEXT_TERMINAL_IS_TABS_NARROW_FOCUS, KEYBINDING_CONTEXT_TERMINAL_TABS_FOCUS, TerminalSettingId } from 'vs/workbench/contrib/terminal/common/terminal'; import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage'; import { ILogService } from 'vs/platform/log/common/log'; import { localize } from 'vs/nls'; @@ -113,10 +113,10 @@ export class TerminalTabbedView extends Disposable { this._terminalTabsFocusContextKey = KEYBINDING_CONTEXT_TERMINAL_TABS_FOCUS.bindTo(contextKeyService); _configurationService.onDidChangeConfiguration(e => { - if (e.affectsConfiguration(TERMINAL_SETTING_ID.TabsEnabled) || - e.affectsConfiguration(TERMINAL_SETTING_ID.TabsHideCondition)) { + if (e.affectsConfiguration(TerminalSettingId.TabsEnabled) || + e.affectsConfiguration(TerminalSettingId.TabsHideCondition)) { this._refreshShowTabs(); - } else if (e.affectsConfiguration(TERMINAL_SETTING_ID.TabsLocation)) { + } else if (e.affectsConfiguration(TerminalSettingId.TabsLocation)) { this._tabTreeIndex = this._terminalService.configHelper.config.tabs.location === 'left' ? 0 : 1; this._terminalContainerIndex = this._terminalService.configHelper.config.tabs.location === 'left' ? 1 : 0; if (this._shouldShowTabs()) { @@ -460,15 +460,15 @@ export class TerminalTabbedView extends Disposable { private _getTabActions(): Action[] { return [ new Separator(), - this._configurationService.inspect(TERMINAL_SETTING_ID.TabsLocation).userValue === 'left' ? + this._configurationService.inspect(TerminalSettingId.TabsLocation).userValue === 'left' ? new Action('moveRight', localize('moveTabsRight', "Move Tabs Right"), undefined, undefined, async () => { - this._configurationService.updateValue(TERMINAL_SETTING_ID.TabsLocation, 'right'); + this._configurationService.updateValue(TerminalSettingId.TabsLocation, 'right'); }) : new Action('moveLeft', localize('moveTabsLeft', "Move Tabs Left"), undefined, undefined, async () => { - this._configurationService.updateValue(TERMINAL_SETTING_ID.TabsLocation, 'left'); + this._configurationService.updateValue(TerminalSettingId.TabsLocation, 'left'); }), new Action('hideTabs', localize('hideTabs', "Hide Tabs"), undefined, undefined, async () => { - this._configurationService.updateValue(TERMINAL_SETTING_ID.TabsEnabled, false); + this._configurationService.updateValue(TerminalSettingId.TabsEnabled, false); }) ]; } diff --git a/src/vs/workbench/contrib/terminal/browser/terminalTabsWidget.ts b/src/vs/workbench/contrib/terminal/browser/terminalTabsWidget.ts index e9c01e6ef78a0..84b95d3e2f04a 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalTabsWidget.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalTabsWidget.ts @@ -18,7 +18,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar'; import { MenuItemAction } from 'vs/platform/actions/common/actions'; import { MenuEntryActionViewItem } from 'vs/platform/actions/browser/menuEntryActionViewItem'; -import { KEYBINDING_CONTEXT_TERMINAL_TABS_SINGULAR_SELECTION, TERMINAL_COMMAND_ID, TERMINAL_SETTING_ID } from 'vs/workbench/contrib/terminal/common/terminal'; +import { KEYBINDING_CONTEXT_TERMINAL_TABS_SINGULAR_SELECTION, TerminalCommandId, TerminalSettingId } from 'vs/workbench/contrib/terminal/common/terminal'; import { Codicon } from 'vs/base/common/codicons'; import { Action } from 'vs/base/common/actions'; import { MarkdownString } from 'vs/base/common/htmlContent'; @@ -98,7 +98,7 @@ export class TerminalTabsWidget extends WorkbenchObjectTree this.onMouseClick(e => { // If focus mode is single click focus the element unless a multi-select in happening - const focusMode = configurationService.getValue<'singleClick' | 'doubleClick'>(TERMINAL_SETTING_ID.TabsFocusMode); + const focusMode = configurationService.getValue<'singleClick' | 'doubleClick'>(TerminalSettingId.TabsFocusMode); if (focusMode === 'singleClick') { if (this.getSelection().length <= 1) { e.element?.focus(true); @@ -312,10 +312,10 @@ class TerminalTabsRenderer implements ITreeRenderer { + new Action(TerminalCommandId.SplitInstance, localize('terminal.split', "Split"), ThemeIcon.asClassName(Codicon.splitHorizontal), true, async () => { this._runForSelectionOrInstance(instance, e => this._terminalService.splitInstance(e)); }), - new Action(TERMINAL_COMMAND_ID.KillInstance, localize('terminal.kill', "Kill"), ThemeIcon.asClassName(Codicon.trashcan), true, async () => { + new Action(TerminalCommandId.KillInstance, localize('terminal.kill', "Kill"), ThemeIcon.asClassName(Codicon.trashcan), true, async () => { this._runForSelectionOrInstance(instance, e => e.dispose()); }) ]; diff --git a/src/vs/workbench/contrib/terminal/browser/terminalView.ts b/src/vs/workbench/contrib/terminal/browser/terminalView.ts index 8adbd9df560ec..1f2af75a647ff 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalView.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalView.ts @@ -21,7 +21,7 @@ import { IViewDescriptorService } from 'vs/workbench/common/views'; import { IOpenerService } from 'vs/platform/opener/common/opener'; import { PANEL_BACKGROUND, SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme'; import { IMenu, IMenuService, MenuId, MenuItemAction } from 'vs/platform/actions/common/actions'; -import { ITerminalProfile, TERMINAL_COMMAND_ID, TERMINAL_SETTING_ID } from 'vs/workbench/contrib/terminal/common/terminal'; +import { ITerminalProfile, TerminalCommandId, TerminalSettingId } from 'vs/workbench/contrib/terminal/common/terminal'; import { ActionViewItem, SelectActionViewItem } from 'vs/base/browser/ui/actionbar/actionViewItems'; import { ITerminalContributionService } from 'vs/workbench/contrib/terminal/common/terminalExtensionPoints'; import { attachSelectBoxStyler, attachStylerCallback } from 'vs/platform/theme/common/styler'; @@ -109,12 +109,12 @@ export class TerminalViewPane extends ViewPane { this._parentDomElement.appendChild(this._fontStyleElement); this._register(this.configurationService.onDidChangeConfiguration(e => { - if (e.affectsConfiguration(TERMINAL_SETTING_ID.FontFamily) || e.affectsConfiguration('editor.fontFamily')) { + if (e.affectsConfiguration(TerminalSettingId.FontFamily) || e.affectsConfiguration('editor.fontFamily')) { const configHelper = this._terminalService.configHelper; if (!configHelper.configFontIsMonospace()) { const choices: IPromptChoice[] = [{ label: nls.localize('terminal.useMonospace', "Use 'monospace'"), - run: () => this.configurationService.updateValue(TERMINAL_SETTING_ID.FontFamily, 'monospace'), + run: () => this.configurationService.updateValue(TerminalSettingId.FontFamily, 'monospace'), }]; this._notificationService.prompt(Severity.Warning, nls.localize('terminal.monospaceOnly', "The terminal only supports monospace fonts. Be sure to restart VS Code if this is a newly installed font."), choices); } @@ -173,15 +173,15 @@ export class TerminalViewPane extends ViewPane { public override getActionViewItem(action: Action): IActionViewItem | undefined { switch (action.id) { - case TERMINAL_COMMAND_ID.SwitchTerminal: { + case TerminalCommandId.SwitchTerminal: { return this._instantiationService.createInstance(SwitchTerminalActionViewItem, action); } - case TERMINAL_COMMAND_ID.Focus: { + case TerminalCommandId.Focus: { const actions: IAction[] = []; createAndFillInContextMenuActions(this._singleTabMenu, undefined, actions); return this._instantiationService.createInstance(SingleTerminalTabActionViewItem, action, actions); } - case TERMINAL_COMMAND_ID.CreateWithProfileButton: { + case TerminalCommandId.CreateWithProfileButton: { if (this._tabButtons) { this._tabButtons.dispose(); } @@ -210,8 +210,8 @@ export class TerminalViewPane extends ViewPane { const submenuActions: IAction[] = []; for (const p of profiles) { - dropdownActions.push(new MenuItemAction({ id: TERMINAL_COMMAND_ID.NewWithProfile, title: p.profileName, category: TerminalTabContextMenuGroup.Profile }, undefined, { arg: p, shouldForwardArgs: true }, this._contextKeyService, this._commandService)); - submenuActions.push(new MenuItemAction({ id: TERMINAL_COMMAND_ID.Split, title: p.profileName, category: TerminalTabContextMenuGroup.Profile }, undefined, { arg: p, shouldForwardArgs: true }, this._contextKeyService, this._commandService)); + dropdownActions.push(new MenuItemAction({ id: TerminalCommandId.NewWithProfile, title: p.profileName, category: TerminalTabContextMenuGroup.Profile }, undefined, { arg: p, shouldForwardArgs: true }, this._contextKeyService, this._commandService)); + submenuActions.push(new MenuItemAction({ id: TerminalCommandId.Split, title: p.profileName, category: TerminalTabContextMenuGroup.Profile }, undefined, { arg: p, shouldForwardArgs: true }, this._contextKeyService, this._commandService)); } for (const contributed of this._terminalContributionService.terminalTypes) { @@ -232,7 +232,7 @@ export class TerminalViewPane extends ViewPane { } } - const primaryAction = this._instantiationService.createInstance(MenuItemAction, { id: TERMINAL_COMMAND_ID.New, title: nls.localize('terminal.new', "New Terminal"), icon: Codicon.plus }, undefined, undefined); + const primaryAction = this._instantiationService.createInstance(MenuItemAction, { id: TerminalCommandId.New, title: nls.localize('terminal.new', "New Terminal"), icon: Codicon.plus }, undefined, undefined); const dropdownAction = new Action('refresh profiles', 'Launch Profile...', 'codicon-chevron-down', true); return { primaryAction, dropdownAction, dropdownMenuActions: dropdownActions, className: 'terminal-tab-actions' }; } diff --git a/src/vs/workbench/contrib/terminal/common/terminal.ts b/src/vs/workbench/contrib/terminal/common/terminal.ts index 5f0aaaeff9c51..5096d74604e84 100644 --- a/src/vs/workbench/contrib/terminal/common/terminal.ts +++ b/src/vs/workbench/contrib/terminal/common/terminal.ts @@ -343,21 +343,21 @@ export interface ITerminalProcessManager extends IDisposable { export const enum ProcessState { // The process has not been initialized yet. - UNINITIALIZED, + Uninitialized, // The process is currently launching, the process is marked as launching // for a short duration after being created and is helpful to indicate // whether the process died as a result of bad shell and args. - LAUNCHING, + Launching, // The process is running normally. - RUNNING, + Running, // The process was killed during launch, likely as a result of bad shell and // args. - KILLED_DURING_LAUNCH, + KilledDuringLaunch, // The process was killed by the user (the event originated from VS Code). - KILLED_BY_USER, + KilledByUser, // The process was killed by itself, for example the shell crashed or `exit` // was run. - KILLED_BY_PROCESS + KilledByProcess } export interface ITerminalProcessExtHostProxy extends IDisposable { @@ -406,7 +406,7 @@ export enum TitleEventSource { export const QUICK_LAUNCH_PROFILE_CHOICE = 'workbench.action.terminal.profile.choice'; -export const enum TERMINAL_SETTING_ID { +export const enum TerminalSettingId { ShellLinux = 'terminal.integrated.shell.linux', ShellMacOs = 'terminal.integrated.shell.osx', ShellWindows = 'terminal.integrated.shell.windows', @@ -477,7 +477,7 @@ export const enum TERMINAL_SETTING_ID { AllowWorkspaceConfiguration = 'terminal.integrated.allowWorkspaceConfiguration' } -export const enum TERMINAL_COMMAND_ID { +export const enum TerminalCommandId { FindNext = 'workbench.action.terminal.findNext', FindPrevious = 'workbench.action.terminal.findPrevious', Toggle = 'workbench.action.terminal.toggleTerminal', @@ -555,57 +555,57 @@ export const enum TERMINAL_COMMAND_ID { } export const DEFAULT_COMMANDS_TO_SKIP_SHELL: string[] = [ - TERMINAL_COMMAND_ID.ClearSelection, - TERMINAL_COMMAND_ID.Clear, - TERMINAL_COMMAND_ID.CopySelection, - TERMINAL_COMMAND_ID.DeleteToLineStart, - TERMINAL_COMMAND_ID.DeleteWordLeft, - TERMINAL_COMMAND_ID.DeleteWordRight, - TERMINAL_COMMAND_ID.FindFocus, - TERMINAL_COMMAND_ID.FindHide, - TERMINAL_COMMAND_ID.FindNext, - TERMINAL_COMMAND_ID.FindPrevious, - TERMINAL_COMMAND_ID.ToggleFindRegex, - TERMINAL_COMMAND_ID.ToggleFindWholeWord, - TERMINAL_COMMAND_ID.ToggleFindCaseSensitive, - TERMINAL_COMMAND_ID.FocusNextPane, - TERMINAL_COMMAND_ID.FocusNext, - TERMINAL_COMMAND_ID.FocusPreviousPane, - TERMINAL_COMMAND_ID.FocusPrevious, - TERMINAL_COMMAND_ID.Focus, - TERMINAL_COMMAND_ID.Kill, - TERMINAL_COMMAND_ID.MoveToLineEnd, - TERMINAL_COMMAND_ID.MoveToLineStart, - TERMINAL_COMMAND_ID.NewInActiveWorkspace, - TERMINAL_COMMAND_ID.New, - TERMINAL_COMMAND_ID.Paste, - TERMINAL_COMMAND_ID.PasteSelection, - TERMINAL_COMMAND_ID.ResizePaneDown, - TERMINAL_COMMAND_ID.ResizePaneLeft, - TERMINAL_COMMAND_ID.ResizePaneRight, - TERMINAL_COMMAND_ID.ResizePaneUp, - TERMINAL_COMMAND_ID.RunActiveFile, - TERMINAL_COMMAND_ID.RunSelectedText, - TERMINAL_COMMAND_ID.ScrollDownLine, - TERMINAL_COMMAND_ID.ScrollDownPage, - TERMINAL_COMMAND_ID.ScrollToBottom, - TERMINAL_COMMAND_ID.ScrollToNextCommand, - TERMINAL_COMMAND_ID.ScrollToPreviousCommand, - TERMINAL_COMMAND_ID.ScrollToTop, - TERMINAL_COMMAND_ID.ScrollUpLine, - TERMINAL_COMMAND_ID.ScrollUpPage, - TERMINAL_COMMAND_ID.SendSequence, - TERMINAL_COMMAND_ID.SelectAll, - TERMINAL_COMMAND_ID.SelectToNextCommand, - TERMINAL_COMMAND_ID.SelectToNextLine, - TERMINAL_COMMAND_ID.SelectToPreviousCommand, - TERMINAL_COMMAND_ID.SelectToPreviousLine, - TERMINAL_COMMAND_ID.SplitInActiveWorkspace, - TERMINAL_COMMAND_ID.Split, - TERMINAL_COMMAND_ID.Toggle, - TERMINAL_COMMAND_ID.NavigationModeExit, - TERMINAL_COMMAND_ID.NavigationModeFocusNext, - TERMINAL_COMMAND_ID.NavigationModeFocusPrevious, + TerminalCommandId.ClearSelection, + TerminalCommandId.Clear, + TerminalCommandId.CopySelection, + TerminalCommandId.DeleteToLineStart, + TerminalCommandId.DeleteWordLeft, + TerminalCommandId.DeleteWordRight, + TerminalCommandId.FindFocus, + TerminalCommandId.FindHide, + TerminalCommandId.FindNext, + TerminalCommandId.FindPrevious, + TerminalCommandId.ToggleFindRegex, + TerminalCommandId.ToggleFindWholeWord, + TerminalCommandId.ToggleFindCaseSensitive, + TerminalCommandId.FocusNextPane, + TerminalCommandId.FocusNext, + TerminalCommandId.FocusPreviousPane, + TerminalCommandId.FocusPrevious, + TerminalCommandId.Focus, + TerminalCommandId.Kill, + TerminalCommandId.MoveToLineEnd, + TerminalCommandId.MoveToLineStart, + TerminalCommandId.NewInActiveWorkspace, + TerminalCommandId.New, + TerminalCommandId.Paste, + TerminalCommandId.PasteSelection, + TerminalCommandId.ResizePaneDown, + TerminalCommandId.ResizePaneLeft, + TerminalCommandId.ResizePaneRight, + TerminalCommandId.ResizePaneUp, + TerminalCommandId.RunActiveFile, + TerminalCommandId.RunSelectedText, + TerminalCommandId.ScrollDownLine, + TerminalCommandId.ScrollDownPage, + TerminalCommandId.ScrollToBottom, + TerminalCommandId.ScrollToNextCommand, + TerminalCommandId.ScrollToPreviousCommand, + TerminalCommandId.ScrollToTop, + TerminalCommandId.ScrollUpLine, + TerminalCommandId.ScrollUpPage, + TerminalCommandId.SendSequence, + TerminalCommandId.SelectAll, + TerminalCommandId.SelectToNextCommand, + TerminalCommandId.SelectToNextLine, + TerminalCommandId.SelectToPreviousCommand, + TerminalCommandId.SelectToPreviousLine, + TerminalCommandId.SplitInActiveWorkspace, + TerminalCommandId.Split, + TerminalCommandId.Toggle, + TerminalCommandId.NavigationModeExit, + TerminalCommandId.NavigationModeFocusNext, + TerminalCommandId.NavigationModeFocusPrevious, 'editor.action.toggleTabFocusMode', 'workbench.action.quickOpen', 'workbench.action.quickOpenPreviousEditor', diff --git a/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts b/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts index 1a5d45b9788da..1874578ab9d22 100644 --- a/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts +++ b/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts @@ -6,7 +6,7 @@ import { ConfigurationScope, IConfigurationNode } from 'vs/platform/configuration/common/configurationRegistry'; import { localize } from 'vs/nls'; import { EDITOR_FONT_DEFAULTS } from 'vs/editor/common/config/editorOptions'; -import { DEFAULT_LETTER_SPACING, DEFAULT_LINE_HEIGHT, TerminalCursorStyle, DEFAULT_COMMANDS_TO_SKIP_SHELL, SUGGESTIONS_FONT_WEIGHT, MINIMUM_FONT_WEIGHT, MAXIMUM_FONT_WEIGHT, DEFAULT_LOCAL_ECHO_EXCLUDE, TERMINAL_SETTING_ID } from 'vs/workbench/contrib/terminal/common/terminal'; +import { DEFAULT_LETTER_SPACING, DEFAULT_LINE_HEIGHT, TerminalCursorStyle, DEFAULT_COMMANDS_TO_SKIP_SHELL, SUGGESTIONS_FONT_WEIGHT, MINIMUM_FONT_WEIGHT, MAXIMUM_FONT_WEIGHT, DEFAULT_LOCAL_ECHO_EXCLUDE, TerminalSettingId } from 'vs/workbench/contrib/terminal/common/terminal'; import { isMacintosh, isWindows } from 'vs/base/common/platform'; import { IJSONSchema } from 'vs/base/common/jsonSchema'; @@ -53,12 +53,12 @@ export const terminalConfiguration: IConfigurationNode = { title: localize('terminalIntegratedConfigurationTitle', "Integrated Terminal"), type: 'object', properties: { - [TERMINAL_SETTING_ID.SendKeybindingsToShell]: { + [TerminalSettingId.SendKeybindingsToShell]: { markdownDescription: localize('terminal.integrated.sendKeybindingsToShell', "Dispatches most keybindings to the terminal instead of the workbench, overriding `#terminal.integrated.commandsToSkipShell#`, which can be used alternatively for fine tuning."), type: 'boolean', default: false }, - [TERMINAL_SETTING_ID.AutomationShellLinux]: { + [TerminalSettingId.AutomationShellLinux]: { restricted: true, markdownDescription: localize({ key: 'terminal.integrated.automationShell.linux', @@ -67,7 +67,7 @@ export const terminalConfiguration: IConfigurationNode = { type: ['string', 'null'], default: null }, - [TERMINAL_SETTING_ID.AutomationShellMacOs]: { + [TerminalSettingId.AutomationShellMacOs]: { restricted: true, markdownDescription: localize({ key: 'terminal.integrated.automationShell.osx', @@ -76,7 +76,7 @@ export const terminalConfiguration: IConfigurationNode = { type: ['string', 'null'], default: null }, - [TERMINAL_SETTING_ID.AutomationShellWindows]: { + [TerminalSettingId.AutomationShellWindows]: { restricted: true, markdownDescription: localize({ key: 'terminal.integrated.automationShell.windows', @@ -85,28 +85,28 @@ export const terminalConfiguration: IConfigurationNode = { type: ['string', 'null'], default: null }, - [TERMINAL_SETTING_ID.ShellLinux]: { + [TerminalSettingId.ShellLinux]: { restricted: true, markdownDescription: localize('terminal.integrated.shell.linux', "The path of the shell that the terminal uses on Linux. [Read more about configuring the shell](https://code.visualstudio.com/docs/editor/integrated-terminal#_configuration)."), type: ['string', 'null'], default: null, markdownDeprecationMessage: 'This is deprecated, use `#terminal.integrated.defaultProfile.linux#` instead' }, - [TERMINAL_SETTING_ID.ShellMacOs]: { + [TerminalSettingId.ShellMacOs]: { restricted: true, markdownDescription: localize('terminal.integrated.shell.osx', "The path of the shell that the terminal uses on macOS. [Read more about configuring the shell](https://code.visualstudio.com/docs/editor/integrated-terminal#_configuration)."), type: ['string', 'null'], default: null, markdownDeprecationMessage: 'This is deprecated, use `#terminal.integrated.defaultProfile.osx#` instead' }, - [TERMINAL_SETTING_ID.ShellWindows]: { + [TerminalSettingId.ShellWindows]: { restricted: true, markdownDescription: localize('terminal.integrated.shell.windows', "The path of the shell that the terminal uses on Windows. [Read more about configuring the shell](https://code.visualstudio.com/docs/editor/integrated-terminal#_configuration)."), type: ['string', 'null'], default: null, markdownDeprecationMessage: 'This is deprecated, use `#terminal.integrated.defaultProfile.windows#` instead' }, - [TERMINAL_SETTING_ID.ShellArgsLinux]: { + [TerminalSettingId.ShellArgsLinux]: { restricted: true, markdownDescription: localize('terminal.integrated.shellArgs.linux', "The command line arguments to use when on the Linux terminal. [Read more about configuring the shell](https://code.visualstudio.com/docs/editor/integrated-terminal#_configuration)."), type: 'array', @@ -116,7 +116,7 @@ export const terminalConfiguration: IConfigurationNode = { default: [], markdownDeprecationMessage: 'This is deprecated, use `#terminal.integrated.defaultProfile.linux#` instead' }, - [TERMINAL_SETTING_ID.ShellArgsMacOs]: { + [TerminalSettingId.ShellArgsMacOs]: { restricted: true, markdownDescription: localize('terminal.integrated.shellArgs.osx', "The command line arguments to use when on the macOS terminal. [Read more about configuring the shell](https://code.visualstudio.com/docs/editor/integrated-terminal#_configuration)."), type: 'array', @@ -129,7 +129,7 @@ export const terminalConfiguration: IConfigurationNode = { default: ['-l'], markdownDeprecationMessage: 'This is deprecated, use `#terminal.integrated.defaultProfile.osx#` instead' }, - [TERMINAL_SETTING_ID.ShellArgsWindows]: { + [TerminalSettingId.ShellArgsWindows]: { restricted: true, markdownDescription: localize('terminal.integrated.shellArgs.windows', "The command line arguments to use when on the Windows terminal. [Read more about configuring the shell](https://code.visualstudio.com/docs/editor/integrated-terminal#_configuration)."), 'anyOf': [ @@ -148,7 +148,7 @@ export const terminalConfiguration: IConfigurationNode = { default: [], markdownDeprecationMessage: 'This is deprecated, use `#terminal.integrated.defaultProfile.windows#` instead' }, - [TERMINAL_SETTING_ID.ProfilesWindows]: { + [TerminalSettingId.ProfilesWindows]: { restricted: true, markdownDescription: localize( { @@ -208,7 +208,7 @@ export const terminalConfiguration: IConfigurationNode = { ] } }, - [TERMINAL_SETTING_ID.ProfilesMacOs]: { + [TerminalSettingId.ProfilesMacOs]: { restricted: true, markdownDescription: localize( { @@ -245,7 +245,7 @@ export const terminalConfiguration: IConfigurationNode = { ] } }, - [TERMINAL_SETTING_ID.ProfilesLinux]: { + [TerminalSettingId.ProfilesLinux]: { restricted: true, markdownDescription: localize( { @@ -281,35 +281,35 @@ export const terminalConfiguration: IConfigurationNode = { ] } }, - [TERMINAL_SETTING_ID.DefaultProfileLinux]: { + [TerminalSettingId.DefaultProfileLinux]: { description: localize('terminal.integrated.defaultProfile.linux', 'The default profile used on Linux. When set to a valid profile name, this will override the values of `terminal.integrated.shell.osx` and `terminal.integrated.shellArgs.osx`.'), type: ['string', 'null'], default: null, scope: ConfigurationScope.APPLICATION // Disallow setting the default in workspace settings }, - [TERMINAL_SETTING_ID.DefaultProfileMacOs]: { + [TerminalSettingId.DefaultProfileMacOs]: { description: localize('terminal.integrated.defaultProfile.osx', 'The default profile used on macOS. When set to a valid profile name, this will override the values of `terminal.integrated.shell.osx` and `terminal.integrated.shellArgs.osx`.'), type: ['string', 'null'], default: null, scope: ConfigurationScope.APPLICATION // Disallow setting the default in workspace settings }, - [TERMINAL_SETTING_ID.DefaultProfileWindows]: { + [TerminalSettingId.DefaultProfileWindows]: { description: localize('terminal.integrated.defaultProfile.windows', 'The default profile used on Windows. When set to a valid profile name, this will override the values of `terminal.integrated.shell.windows` and `terminal.integrated.shellArgs.windows`.'), type: ['string', 'null'], default: null, scope: ConfigurationScope.APPLICATION // Disallow setting the default in workspace settings }, - [TERMINAL_SETTING_ID.UseWslProfiles]: { + [TerminalSettingId.UseWslProfiles]: { description: localize('terminal.integrated.useWslProfiles', 'Controls whether or not WSL distros are shown in the terminal dropdown'), type: 'boolean', default: true }, - [TERMINAL_SETTING_ID.TabsEnabled]: { + [TerminalSettingId.TabsEnabled]: { description: localize('terminal.integrated.tabs.enabled', 'Controls whether terminal tabs display as a list to the side of the terminal. When this is disabled a dropdown will display instead.'), type: 'boolean', default: true, }, - [TERMINAL_SETTING_ID.TabsHideCondition]: { + [TerminalSettingId.TabsHideCondition]: { description: localize('terminal.integrated.tabs.hideCondition', 'Controls whether the terminal tabs view will hide under certain conditions.'), type: 'string', enum: ['never', 'singleTerminal'], @@ -319,7 +319,7 @@ export const terminalConfiguration: IConfigurationNode = { ], default: 'singleTerminal', }, - [TERMINAL_SETTING_ID.TabsShowActiveTerminal]: { + [TerminalSettingId.TabsShowActiveTerminal]: { description: localize('terminal.integrated.tabs.showActiveTerminal', 'Shows the active terminal information in the view, this is particularly useful when the title within the tabs aren\'t visible.'), type: 'string', enum: ['always', 'singleTerminal', 'singleTerminalOrNarrow', 'never'], @@ -331,7 +331,7 @@ export const terminalConfiguration: IConfigurationNode = { ], default: 'singleTerminalOrNarrow', }, - [TERMINAL_SETTING_ID.TabsLocation]: { + [TerminalSettingId.TabsLocation]: { type: 'string', enum: ['left', 'right'], enumDescriptions: [ @@ -341,7 +341,7 @@ export const terminalConfiguration: IConfigurationNode = { default: 'right', description: localize('terminal.integrated.tabs.location', "Controls the location of the terminal tabs, either to the left or right of the actual terminal(s).") }, - [TERMINAL_SETTING_ID.TabsFocusMode]: { + [TerminalSettingId.TabsFocusMode]: { type: 'string', enum: ['singleClick', 'doubleClick'], enumDescriptions: [ @@ -351,32 +351,32 @@ export const terminalConfiguration: IConfigurationNode = { default: 'doubleClick', description: localize('terminal.integrated.tabs.focusMode', "Controls whether focusing the terminal of a tab happens on double or single click.") }, - [TERMINAL_SETTING_ID.MacOptionIsMeta]: { + [TerminalSettingId.MacOptionIsMeta]: { description: localize('terminal.integrated.macOptionIsMeta', "Controls whether to treat the option key as the meta key in the terminal on macOS."), type: 'boolean', default: false }, - [TERMINAL_SETTING_ID.MacOptionClickForcesSelection]: { + [TerminalSettingId.MacOptionClickForcesSelection]: { description: localize('terminal.integrated.macOptionClickForcesSelection', "Controls whether to force selection when using Option+click on macOS. This will force a regular (line) selection and disallow the use of column selection mode. This enables copying and pasting using the regular terminal selection, for example, when mouse mode is enabled in tmux."), type: 'boolean', default: false }, - [TERMINAL_SETTING_ID.AltClickMovesCursor]: { + [TerminalSettingId.AltClickMovesCursor]: { markdownDescription: localize('terminal.integrated.altClickMovesCursor', "If enabled, alt/option + click will reposition the prompt cursor to underneath the mouse when `#editor.multiCursorModifier#` is set to `'alt'` (the default value). This may not work reliably depending on your shell."), type: 'boolean', default: true }, - [TERMINAL_SETTING_ID.CopyOnSelection]: { + [TerminalSettingId.CopyOnSelection]: { description: localize('terminal.integrated.copyOnSelection', "Controls whether text selected in the terminal will be copied to the clipboard."), type: 'boolean', default: false }, - [TERMINAL_SETTING_ID.DrawBoldTextInBrightColors]: { + [TerminalSettingId.DrawBoldTextInBrightColors]: { description: localize('terminal.integrated.drawBoldTextInBrightColors', "Controls whether bold text in the terminal will always use the \"bright\" ANSI color variant."), type: 'boolean', default: true }, - [TERMINAL_SETTING_ID.FontFamily]: { + [TerminalSettingId.FontFamily]: { markdownDescription: localize('terminal.integrated.fontFamily', "Controls the font family of the terminal, this defaults to `#editor.fontFamily#`'s value."), type: 'string' }, @@ -386,42 +386,42 @@ export const terminalConfiguration: IConfigurationNode = { // 'type': 'boolean', // 'default': false // }, - [TERMINAL_SETTING_ID.FontSize]: { + [TerminalSettingId.FontSize]: { description: localize('terminal.integrated.fontSize', "Controls the font size in pixels of the terminal."), type: 'number', default: EDITOR_FONT_DEFAULTS.fontSize }, - [TERMINAL_SETTING_ID.LetterSpacing]: { + [TerminalSettingId.LetterSpacing]: { description: localize('terminal.integrated.letterSpacing', "Controls the letter spacing of the terminal, this is an integer value which represents the amount of additional pixels to add between characters."), type: 'number', default: DEFAULT_LETTER_SPACING }, - [TERMINAL_SETTING_ID.LineHeight]: { + [TerminalSettingId.LineHeight]: { description: localize('terminal.integrated.lineHeight', "Controls the line height of the terminal, this number is multiplied by the terminal font size to get the actual line-height in pixels."), type: 'number', default: DEFAULT_LINE_HEIGHT }, - [TERMINAL_SETTING_ID.MinimumContrastRatio]: { + [TerminalSettingId.MinimumContrastRatio]: { markdownDescription: localize('terminal.integrated.minimumContrastRatio', "When set the foreground color of each cell will change to try meet the contrast ratio specified. Example values:\n\n- 1: The default, do nothing.\n- 4.5: [WCAG AA compliance (minimum)](https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html).\n- 7: [WCAG AAA compliance (enhanced)](https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast7.html).\n- 21: White on black or black on white."), type: 'number', default: 1 }, - [TERMINAL_SETTING_ID.FastScrollSensitivity]: { + [TerminalSettingId.FastScrollSensitivity]: { markdownDescription: localize('terminal.integrated.fastScrollSensitivity', "Scrolling speed multiplier when pressing `Alt`."), type: 'number', default: 5 }, - [TERMINAL_SETTING_ID.MouseWheelScrollSensitivity]: { + [TerminalSettingId.MouseWheelScrollSensitivity]: { markdownDescription: localize('terminal.integrated.mouseWheelScrollSensitivity', "A multiplier to be used on the `deltaY` of mouse wheel scroll events."), type: 'number', default: 1 }, - [TERMINAL_SETTING_ID.BellDuration]: { + [TerminalSettingId.BellDuration]: { markdownDescription: localize('terminal.integrated.bellDuration', "The number of milliseconds to show the bell within a terminal tab when triggered."), type: 'number', default: 1000 }, - [TERMINAL_SETTING_ID.FontWeight]: { + [TerminalSettingId.FontWeight]: { 'anyOf': [ { type: 'number', @@ -440,7 +440,7 @@ export const terminalConfiguration: IConfigurationNode = { description: localize('terminal.integrated.fontWeight', "The font weight to use within the terminal for non-bold text. Accepts \"normal\" and \"bold\" keywords or numbers between 1 and 1000."), default: 'normal' }, - [TERMINAL_SETTING_ID.FontWeightBold]: { + [TerminalSettingId.FontWeightBold]: { 'anyOf': [ { type: 'number', @@ -459,27 +459,27 @@ export const terminalConfiguration: IConfigurationNode = { description: localize('terminal.integrated.fontWeightBold', "The font weight to use within the terminal for bold text. Accepts \"normal\" and \"bold\" keywords or numbers between 1 and 1000."), default: 'bold' }, - [TERMINAL_SETTING_ID.CursorBlinking]: { + [TerminalSettingId.CursorBlinking]: { description: localize('terminal.integrated.cursorBlinking', "Controls whether the terminal cursor blinks."), type: 'boolean', default: false }, - [TERMINAL_SETTING_ID.CursorStyle]: { + [TerminalSettingId.CursorStyle]: { description: localize('terminal.integrated.cursorStyle', "Controls the style of terminal cursor."), enum: [TerminalCursorStyle.BLOCK, TerminalCursorStyle.LINE, TerminalCursorStyle.UNDERLINE], default: TerminalCursorStyle.BLOCK }, - [TERMINAL_SETTING_ID.CursorWidth]: { + [TerminalSettingId.CursorWidth]: { markdownDescription: localize('terminal.integrated.cursorWidth', "Controls the width of the cursor when `#terminal.integrated.cursorStyle#` is set to `line`."), type: 'number', default: 1 }, - [TERMINAL_SETTING_ID.Scrollback]: { + [TerminalSettingId.Scrollback]: { description: localize('terminal.integrated.scrollback', "Controls the maximum amount of lines the terminal keeps in its buffer."), type: 'number', default: 1000 }, - [TERMINAL_SETTING_ID.DetectLocale]: { + [TerminalSettingId.DetectLocale]: { markdownDescription: localize('terminal.integrated.detectLocale', "Controls whether to detect and set the `$LANG` environment variable to a UTF-8 compliant option since VS Code's terminal only supports UTF-8 encoded data coming from the shell."), type: 'string', enum: ['auto', 'off', 'on'], @@ -490,7 +490,7 @@ export const terminalConfiguration: IConfigurationNode = { ], default: 'auto' }, - [TERMINAL_SETTING_ID.GpuAcceleration]: { + [TerminalSettingId.GpuAcceleration]: { type: 'string', enum: ['auto', 'on', 'off'], markdownEnumDescriptions: [ @@ -501,7 +501,7 @@ export const terminalConfiguration: IConfigurationNode = { default: 'auto', description: localize('terminal.integrated.gpuAcceleration', "Controls whether the terminal will leverage the GPU to do its rendering.") }, - [TERMINAL_SETTING_ID.RightClickBehavior]: { + [TerminalSettingId.RightClickBehavior]: { type: 'string', enum: ['default', 'copyPaste', 'paste', 'selectWord'], enumDescriptions: [ @@ -513,23 +513,23 @@ export const terminalConfiguration: IConfigurationNode = { default: isMacintosh ? 'selectWord' : isWindows ? 'copyPaste' : 'default', description: localize('terminal.integrated.rightClickBehavior', "Controls how terminal reacts to right click.") }, - [TERMINAL_SETTING_ID.Cwd]: { + [TerminalSettingId.Cwd]: { restricted: true, description: localize('terminal.integrated.cwd', "An explicit start path where the terminal will be launched, this is used as the current working directory (cwd) for the shell process. This may be particularly useful in workspace settings if the root directory is not a convenient cwd."), type: 'string', default: undefined }, - [TERMINAL_SETTING_ID.ConfirmOnExit]: { + [TerminalSettingId.ConfirmOnExit]: { description: localize('terminal.integrated.confirmOnExit', "Controls whether to confirm on exit if there are active terminal sessions."), type: 'boolean', default: false }, - [TERMINAL_SETTING_ID.EnableBell]: { + [TerminalSettingId.EnableBell]: { description: localize('terminal.integrated.enableBell', "Controls whether the terminal bell is enabled, this shows up as a visual bell next to the terminal's name."), type: 'boolean', default: false }, - [TERMINAL_SETTING_ID.CommandsToSkipShell]: { + [TerminalSettingId.CommandsToSkipShell]: { markdownDescription: localize('terminal.integrated.commandsToSkipShell', "A set of command IDs whose keybindings will not be sent to the shell but instead always be handled by VS Code. This allows keybindings that would normally be consumed by the shell to act instead the same as when the terminal is not focused, for example `Ctrl+P` to launch Quick Open.\n\n \n\nMany commands are skipped by default. To override a default and pass that command's keybinding to the shell instead, add the command prefixed with the `-` character. For example add `-workbench.action.quickOpen` to allow `Ctrl+P` to reach the shell.\n\n \n\nThe following list of default skipped commands is truncated when viewed in Settings Editor. To see the full list, [open the default settings JSON](command:workbench.action.openRawDefaultSettings 'Open Default Settings (JSON)') and search for the first command from the list below.\n\n \n\nDefault Skipped Commands:\n\n{0}", DEFAULT_COMMANDS_TO_SKIP_SHELL.sort().map(command => `- ${command}`).join('\n')), type: 'array', items: { @@ -537,17 +537,17 @@ export const terminalConfiguration: IConfigurationNode = { }, default: [] }, - [TERMINAL_SETTING_ID.AllowChords]: { + [TerminalSettingId.AllowChords]: { markdownDescription: localize('terminal.integrated.allowChords', "Whether or not to allow chord keybindings in the terminal. Note that when this is true and the keystroke results in a chord it will bypass `#terminal.integrated.commandsToSkipShell#`, setting this to false is particularly useful when you want ctrl+k to go to your shell (not VS Code)."), type: 'boolean', default: true }, - [TERMINAL_SETTING_ID.AllowMnemonics]: { + [TerminalSettingId.AllowMnemonics]: { markdownDescription: localize('terminal.integrated.allowMnemonics', "Whether to allow menubar mnemonics (eg. alt+f) to trigger the open the menubar. Note that this will cause all alt keystrokes to skip the shell when true. This does nothing on macOS."), type: 'boolean', default: false }, - [TERMINAL_SETTING_ID.EnvMacOs]: { + [TerminalSettingId.EnvMacOs]: { restricted: true, markdownDescription: localize('terminal.integrated.env.osx', "Object with environment variables that will be added to the VS Code process to be used by the terminal on macOS. Set to `null` to delete the environment variable."), type: 'object', @@ -556,7 +556,7 @@ export const terminalConfiguration: IConfigurationNode = { }, default: {} }, - [TERMINAL_SETTING_ID.EnvLinux]: { + [TerminalSettingId.EnvLinux]: { restricted: true, markdownDescription: localize('terminal.integrated.env.linux', "Object with environment variables that will be added to the VS Code process to be used by the terminal on Linux. Set to `null` to delete the environment variable."), type: 'object', @@ -565,7 +565,7 @@ export const terminalConfiguration: IConfigurationNode = { }, default: {} }, - [TERMINAL_SETTING_ID.EnvWindows]: { + [TerminalSettingId.EnvWindows]: { restricted: true, markdownDescription: localize('terminal.integrated.env.windows', "Object with environment variables that will be added to the VS Code process to be used by the terminal on Windows. Set to `null` to delete the environment variable."), type: 'object', @@ -574,7 +574,7 @@ export const terminalConfiguration: IConfigurationNode = { }, default: {} }, - [TERMINAL_SETTING_ID.EnvironmentChangesIndicator]: { + [TerminalSettingId.EnvironmentChangesIndicator]: { markdownDescription: localize('terminal.integrated.environmentChangesIndicator', "Whether to display the environment changes indicator on each terminal which explains whether extensions have made, or want to make changes to the terminal's environment."), type: 'string', enum: ['off', 'on', 'warnonly'], @@ -585,17 +585,17 @@ export const terminalConfiguration: IConfigurationNode = { ], default: 'warnonly' }, - [TERMINAL_SETTING_ID.EnvironmentChangesRelaunch]: { + [TerminalSettingId.EnvironmentChangesRelaunch]: { markdownDescription: localize('terminal.integrated.environmentChangesRelaunch', "Whether to relaunch terminals automatically if extension want to contribute to their environment and have not been interacted with yet."), type: 'boolean', default: true }, - [TERMINAL_SETTING_ID.ShowExitAlert]: { + [TerminalSettingId.ShowExitAlert]: { description: localize('terminal.integrated.showExitAlert', "Controls whether to show the alert \"The terminal process terminated with exit code\" when exit code is non-zero."), type: 'boolean', default: true }, - [TERMINAL_SETTING_ID.SplitCwd]: { + [TerminalSettingId.SplitCwd]: { description: localize('terminal.integrated.splitCwd', "Controls the working directory a split terminal starts with."), type: 'string', enum: ['workspaceRoot', 'initial', 'inherited'], @@ -606,27 +606,27 @@ export const terminalConfiguration: IConfigurationNode = { ], default: 'inherited' }, - [TERMINAL_SETTING_ID.WindowsEnableConpty]: { + [TerminalSettingId.WindowsEnableConpty]: { description: localize('terminal.integrated.windowsEnableConpty', "Whether to use ConPTY for Windows terminal process communication (requires Windows 10 build number 18309+). Winpty will be used if this is false."), type: 'boolean', default: true }, - [TERMINAL_SETTING_ID.WordSeparators]: { + [TerminalSettingId.WordSeparators]: { description: localize('terminal.integrated.wordSeparators', "A string containing all characters to be considered word separators by the double click to select word feature."), type: 'string', default: ' ()[]{}\',"`─' }, - [TERMINAL_SETTING_ID.ExperimentalUseTitleEvent]: { + [TerminalSettingId.ExperimentalUseTitleEvent]: { description: localize('terminal.integrated.experimentalUseTitleEvent', "An experimental setting that will use the terminal title event for the dropdown title. This setting will only apply to new terminals."), type: 'boolean', default: false }, - [TERMINAL_SETTING_ID.EnableFileLinks]: { + [TerminalSettingId.EnableFileLinks]: { description: localize('terminal.integrated.enableFileLinks', "Whether to enable file links in the terminal. Links can be slow when working on a network drive in particular because each file link is verified against the file system. Changing this will take effect only in new terminals."), type: 'boolean', default: true }, - [TERMINAL_SETTING_ID.UnicodeVersion]: { + [TerminalSettingId.UnicodeVersion]: { type: 'string', enum: ['6', '11'], enumDescriptions: [ @@ -636,18 +636,18 @@ export const terminalConfiguration: IConfigurationNode = { default: '11', description: localize('terminal.integrated.unicodeVersion', "Controls what version of unicode to use when evaluating the width of characters in the terminal. If you experience emoji or other wide characters not taking up the right amount of space or backspace either deleting too much or too little then you may want to try tweaking this setting.") }, - [TERMINAL_SETTING_ID.ExperimentalLinkProvider]: { + [TerminalSettingId.ExperimentalLinkProvider]: { description: localize('terminal.integrated.experimentalLinkProvider', "An experimental setting that aims to improve link detection in the terminal by improving when links are detected and by enabling shared link detection with the editor. Currently this only supports web links."), type: 'boolean', default: true }, - [TERMINAL_SETTING_ID.LocalEchoLatencyThreshold]: { + [TerminalSettingId.LocalEchoLatencyThreshold]: { description: localize('terminal.integrated.localEchoLatencyThreshold', "Experimental: length of network delay, in milliseconds, where local edits will be echoed on the terminal without waiting for server acknowledgement. If '0', local echo will always be on, and if '-1' it will be disabled."), type: 'integer', minimum: -1, default: 30, }, - [TERMINAL_SETTING_ID.LocalEchoExcludePrograms]: { + [TerminalSettingId.LocalEchoExcludePrograms]: { description: localize('terminal.integrated.localEchoExcludePrograms', "Experimental: local echo will be disabled when any of these program names are found in the terminal title."), type: 'array', items: { @@ -656,7 +656,7 @@ export const terminalConfiguration: IConfigurationNode = { }, default: DEFAULT_LOCAL_ECHO_EXCLUDE, }, - [TERMINAL_SETTING_ID.LocalEchoStyle]: { + [TerminalSettingId.LocalEchoStyle]: { description: localize('terminal.integrated.localEchoStyle', "Experimental: terminal style of locally echoed text; either a font style or an RGB color."), default: 'dim', oneOf: [ @@ -672,12 +672,12 @@ export const terminalConfiguration: IConfigurationNode = { } ] }, - [TERMINAL_SETTING_ID.EnablePersistentSessions]: { + [TerminalSettingId.EnablePersistentSessions]: { description: localize('terminal.integrated.enablePersistentSessions', "Persist terminal sessions for the workspace across window reloads."), type: 'boolean', default: true }, - [TERMINAL_SETTING_ID.AllowWorkspaceConfiguration]: { + [TerminalSettingId.AllowWorkspaceConfiguration]: { scope: ConfigurationScope.APPLICATION, description: localize('terminal.integrated.allowWorkspaceConfiguration', "Allows shell and profile settings to be pick up from a workspace."), type: 'boolean', diff --git a/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts b/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts index 0e8dbef09996b..f6d1aff514a66 100644 --- a/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts +++ b/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts @@ -11,7 +11,7 @@ import { sanitizeProcessEnvironment } from 'vs/base/common/processes'; import { ILogService } from 'vs/platform/log/common/log'; import { IShellLaunchConfig, ITerminalEnvironment } from 'vs/platform/terminal/common/terminal'; import { IProcessEnvironment, isWindows, locale, OperatingSystem, OS, platform, Platform } from 'vs/base/common/platform'; -import { TERMINAL_SETTING_ID } from 'vs/workbench/contrib/terminal/common/terminal'; +import { TerminalSettingId } from 'vs/workbench/contrib/terminal/common/terminal'; /** * This module contains utility functions related to the environment, cwd and paths. @@ -238,18 +238,18 @@ function _sanitizeCwd(cwd: string): string { } export type TerminalShellSetting = ( - TERMINAL_SETTING_ID.AutomationShellWindows - | TERMINAL_SETTING_ID.AutomationShellMacOs - | TERMINAL_SETTING_ID.AutomationShellLinux - | TERMINAL_SETTING_ID.ShellWindows - | TERMINAL_SETTING_ID.ShellMacOs - | TERMINAL_SETTING_ID.ShellLinux + TerminalSettingId.AutomationShellWindows + | TerminalSettingId.AutomationShellMacOs + | TerminalSettingId.AutomationShellLinux + | TerminalSettingId.ShellWindows + | TerminalSettingId.ShellMacOs + | TerminalSettingId.ShellLinux ); export type TerminalShellArgsSetting = ( - TERMINAL_SETTING_ID.ShellArgsWindows - | TERMINAL_SETTING_ID.ShellArgsMacOs - | TERMINAL_SETTING_ID.ShellArgsLinux + TerminalSettingId.ShellArgsWindows + | TerminalSettingId.ShellArgsMacOs + | TerminalSettingId.ShellArgsLinux ); export type VariableResolver = (str: string) => string; diff --git a/src/vs/workbench/contrib/terminal/electron-sandbox/terminalRemote.ts b/src/vs/workbench/contrib/terminal/electron-sandbox/terminalRemote.ts index f862a2f43e596..7f086aaa9913a 100644 --- a/src/vs/workbench/contrib/terminal/electron-sandbox/terminalRemote.ts +++ b/src/vs/workbench/contrib/terminal/electron-sandbox/terminalRemote.ts @@ -7,7 +7,7 @@ import * as nls from 'vs/nls'; import { Registry } from 'vs/platform/registry/common/platform'; import { Extensions as ActionExtensions, IWorkbenchActionRegistry } from 'vs/workbench/common/actions'; import { SyncActionDescriptor } from 'vs/platform/actions/common/actions'; -import { TERMINAL_ACTION_CATEGORY, TERMINAL_COMMAND_ID } from 'vs/workbench/contrib/terminal/common/terminal'; +import { TERMINAL_ACTION_CATEGORY, TerminalCommandId } from 'vs/workbench/contrib/terminal/common/terminal'; import { Action } from 'vs/base/common/actions'; import { ITerminalService } from 'vs/workbench/contrib/terminal/browser/terminal'; import { INativeEnvironmentService } from 'vs/platform/environment/common/environment'; @@ -18,7 +18,7 @@ export function registerRemoteContributions() { } export class CreateNewLocalTerminalAction extends Action { - public static readonly ID = TERMINAL_COMMAND_ID.NewLocal; + public static readonly ID = TerminalCommandId.NewLocal; public static readonly LABEL = nls.localize('workbench.action.terminal.newLocal', "Create New Integrated Terminal (Local)"); constructor( diff --git a/src/vs/workbench/contrib/terminal/node/terminalProfiles.ts b/src/vs/workbench/contrib/terminal/node/terminalProfiles.ts index 4280148374f35..89cdf93939836 100644 --- a/src/vs/workbench/contrib/terminal/node/terminalProfiles.ts +++ b/src/vs/workbench/contrib/terminal/node/terminalProfiles.ts @@ -7,7 +7,7 @@ import * as fs from 'fs'; import { normalize, basename, delimiter } from 'vs/base/common/path'; import { enumeratePowerShellInstallations } from 'vs/base/node/powershell'; import { findExecutable, getWindowsBuildNumber } from 'vs/platform/terminal/node/terminalEnvironment'; -import { ITerminalProfile, ITerminalProfileObject, ProfileSource, TERMINAL_SETTING_ID } from 'vs/workbench/contrib/terminal/common/terminal'; +import { ITerminalProfile, ITerminalProfileObject, ProfileSource, TerminalSettingId } from 'vs/workbench/contrib/terminal/common/terminal'; import * as cp from 'child_process'; import { ExtHostVariableResolverService } from 'vs/workbench/api/common/extHostDebugService'; import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace'; @@ -29,8 +29,8 @@ export function detectAvailableProfiles(configuredProfilesOnly: boolean, safeCon configuredProfilesOnly, fsProvider, logService, - safeConfigProvider(TERMINAL_SETTING_ID.UseWslProfiles) || true, - safeConfigProvider(TERMINAL_SETTING_ID.ProfilesWindows), + safeConfigProvider(TerminalSettingId.UseWslProfiles) || true, + safeConfigProvider(TerminalSettingId.ProfilesWindows), variableResolver, workspaceFolder ); @@ -39,7 +39,7 @@ export function detectAvailableProfiles(configuredProfilesOnly: boolean, safeCon fsProvider, logService, configuredProfilesOnly, - safeConfigProvider(isMacintosh ? TERMINAL_SETTING_ID.ProfilesMacOs : TERMINAL_SETTING_ID.ProfilesLinux), + safeConfigProvider(isMacintosh ? TerminalSettingId.ProfilesMacOs : TerminalSettingId.ProfilesLinux), testPaths, variableResolver, workspaceFolder diff --git a/src/vs/workbench/contrib/watermark/browser/watermark.ts b/src/vs/workbench/contrib/watermark/browser/watermark.ts index 66b0aa3861934..52284e2b6c2ca 100644 --- a/src/vs/workbench/contrib/watermark/browser/watermark.ts +++ b/src/vs/workbench/contrib/watermark/browser/watermark.ts @@ -22,7 +22,7 @@ import * as dom from 'vs/base/browser/dom'; import { KeybindingLabel } from 'vs/base/browser/ui/keybindingLabel/keybindingLabel'; import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; import { CommandsRegistry } from 'vs/platform/commands/common/commands'; -import { TERMINAL_COMMAND_ID } from 'vs/workbench/contrib/terminal/common/terminal'; +import { TerminalCommandId } from 'vs/workbench/contrib/terminal/common/terminal'; import { assertIsDefined } from 'vs/base/common/types'; import { workbenchConfigurationNodeBase } from 'vs/workbench/common/configuration'; import { NEW_UNTITLED_FILE_COMMAND_ID } from 'vs/workbench/contrib/files/browser/fileCommands'; @@ -46,7 +46,7 @@ const openFileOrFolderMacOnly: WatermarkEntry = { text: nls.localize('watermark. const openRecent: WatermarkEntry = { text: nls.localize('watermark.openRecent', "Open Recent"), id: 'workbench.action.openRecent' }; const newUntitledFile: WatermarkEntry = { text: nls.localize('watermark.newUntitledFile', "New Untitled File"), id: NEW_UNTITLED_FILE_COMMAND_ID }; const newUntitledFileMacOnly: WatermarkEntry = Object.assign({ mac: true }, newUntitledFile); -const toggleTerminal: WatermarkEntry = { text: nls.localize({ key: 'watermark.toggleTerminal', comment: ['toggle is a verb here'] }, "Toggle Terminal"), id: TERMINAL_COMMAND_ID.Toggle }; +const toggleTerminal: WatermarkEntry = { text: nls.localize({ key: 'watermark.toggleTerminal', comment: ['toggle is a verb here'] }, "Toggle Terminal"), id: TerminalCommandId.Toggle }; const findInFiles: WatermarkEntry = { text: nls.localize('watermark.findInFiles', "Find in Files"), id: FindInFilesActionId }; const startDebugging: WatermarkEntry = { text: nls.localize('watermark.startDebugging', "Start Debugging"), id: DEBUG_START_COMMAND_ID }; From 2498273ab62886007659e10dd71c9f6c5ea0352a Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 4 May 2021 05:41:43 -0700 Subject: [PATCH 5/5] Relax const rule --- src/vs/workbench/contrib/terminal/.eslintrc.json | 1 - 1 file changed, 1 deletion(-) diff --git a/src/vs/workbench/contrib/terminal/.eslintrc.json b/src/vs/workbench/contrib/terminal/.eslintrc.json index 32c7e99a15f4b..ddd49198e1de4 100644 --- a/src/vs/workbench/contrib/terminal/.eslintrc.json +++ b/src/vs/workbench/contrib/terminal/.eslintrc.json @@ -1,6 +1,5 @@ { "rules": { - "prefer-const": "warn", "@typescript-eslint/naming-convention": [ "warn", // variableLike