Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

SLC description -> type #141913

Merged
merged 3 commits into from Feb 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/vs/platform/terminal/common/terminal.ts
Expand Up @@ -378,9 +378,9 @@ export interface IShellLaunchConfig {
name?: string;

/**
* An string to follow the name of the terminal with, indicating a special kind of terminal
* A string to follow the name of the terminal with, indicating the type of terminal
*/
description?: string;
type?: 'Task' | 'Local';

/**
* The shell executable (bash, cmd, etc.).
Expand Down
6 changes: 3 additions & 3 deletions src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts
Expand Up @@ -1035,7 +1035,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
let isShellCommand = task.command.runtime === RuntimeType.Shell;
let needsFolderQualification = this.contextService.getWorkbenchState() === WorkbenchState.WORKSPACE;
let terminalName = this.createTerminalName(task);
const description = nls.localize('TerminalTaskSystem.terminalDescription', 'Task');
const type = 'Task';
let originalCommand = task.command.name;
if (isShellCommand) {
let os: Platform.OperatingSystem;
Expand All @@ -1052,7 +1052,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
});
shellLaunchConfig = {
name: terminalName,
description,
type,
executable: defaultProfile.path,
args: defaultProfile.args,
icon: defaultProfile.icon,
Expand Down Expand Up @@ -1147,7 +1147,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
// When we have a process task there is no need to quote arguments. So we go ahead and take the string value.
shellLaunchConfig = {
name: terminalName,
description,
type,
executable: executable,
args: args.map(a => Types.isString(a) ? a : a.value),
waitOnExit
Expand Down
Expand Up @@ -226,7 +226,7 @@ export class TerminalEditorInput extends EditorInput {
}

public override getDescription(): string | undefined {
return this._terminalInstance?.description || this._terminalInstance?.shellLaunchConfig.description;
return this._terminalInstance?.description || this._terminalInstance?.shellLaunchConfig.type;
meganrogge marked this conversation as resolved.
Show resolved Hide resolved
}

public override toUntyped(): IUntypedEditorInput {
Expand Down
Expand Up @@ -167,7 +167,7 @@ export class TerminalEditorService extends Disposable implements ITerminalEditor
if (resource) {
await this._editorService.openEditor({
resource,
description: instance.description || instance.shellLaunchConfig.description,
description: instance.description || instance.shellLaunchConfig.type,
meganrogge marked this conversation as resolved.
Show resolved Hide resolved
options:
{
pinned: true,
Expand Down
55 changes: 27 additions & 28 deletions src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
Expand Up @@ -138,15 +138,16 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
private static _lastKnownGridDimensions: IGridDimensions | undefined;
private static _instanceIdCounter = 1;

xterm?: XtermTerminal;
readonly capabilities = new TerminalCapabilityStoreMultiplexer();
private readonly _processManager: ITerminalProcessManager;
private readonly _resource: URI;

// Enables disposal of the xterm onKey
// event when the CwdDetection capability
// is added
private _xtermOnKey: IDisposable | undefined;
private _xtermReadyPromise: Promise<XtermTerminal>;
private _xtermTypeAheadAddon: TypeAheadAddon | undefined;

private readonly _processManager: ITerminalProcessManager;
private _pressAnyKeyToCloseListener: IDisposable | undefined;

private _instanceId: number;
private _latestXtermWriteData: number = 0;
private _latestXtermParseData: number = 0;
Expand Down Expand Up @@ -178,33 +179,16 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
private _initialDataEvents: string[] | undefined = [];
private _containerReadyBarrier: AutoOpenBarrier;
private _attachBarrier: AutoOpenBarrier;

private _icon: TerminalIcon | undefined;

private _messageTitleDisposable: IDisposable | undefined;

private _widgetManager: TerminalWidgetManager = this._instantiationService.createInstance(TerminalWidgetManager);
private _linkManager: TerminalLinkManager | undefined;
private _environmentInfo: { widget: EnvironmentVariableInfoWidget, disposable: IDisposable } | undefined;
private _navigationModeAddon: INavigationMode & ITerminalAddon | undefined;
private _dndObserver: IDisposable | undefined;

private readonly _resource: URI;

private _terminalLinkQuickpick: TerminalLinkQuickpick | undefined;

private _lastLayoutDimensions: dom.Dimension | undefined;

private _hasHadInput: boolean;

// Enables disposal of the xterm onKey
// event when the CwdDetection capability
// is added
private _xtermOnKey: IDisposable | undefined;

readonly statusList: ITerminalStatusList;
disableLayout: boolean = false;

private _description?: string;
private _processName: string = '';
private _sequence?: string;
Expand All @@ -215,6 +199,12 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
private _hasScrollBar?: boolean;
private _target?: TerminalLocation | undefined;

readonly capabilities = new TerminalCapabilityStoreMultiplexer();
readonly statusList: ITerminalStatusList;

xterm?: XtermTerminal;
disableLayout: boolean = false;

get target(): TerminalLocation | undefined { return this._target; }
set target(value: TerminalLocation | undefined) {
if (this.xterm) {
Expand Down Expand Up @@ -262,7 +252,6 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
get areLinksReady(): boolean { return this._areLinksReady; }
get initialDataEvents(): string[] | undefined { return this._initialDataEvents; }
get exitCode(): number | undefined { return this._exitCode; }

get hadFocusOnExit(): boolean { return this._hadFocusOnExit; }
get isTitleSetByProcess(): boolean { return !!this._messageTitleDisposable; }
get shellLaunchConfig(): IShellLaunchConfig { return this._shellLaunchConfig; }
Expand All @@ -276,20 +265,30 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
get titleSource(): TitleEventSource { return this._titleSource; }
get icon(): TerminalIcon | undefined { return this._getIcon(); }
get color(): string | undefined { return this._getColor(); }

get processName(): string { return this._processName; }
get sequence(): string | undefined { return this._sequence; }
get staticTitle(): string | undefined { return this._staticTitle; }
get workspaceFolder(): string | undefined { return this._workspaceFolder; }
get cwd(): string | undefined { return this._cwd; }
get initialCwd(): string | undefined { return this._initialCwd; }
get description(): string | undefined { return this._description || this.shellLaunchConfig.description; }
get description(): string | undefined {
if (this._description) {
return this._description;
} else if (this._shellLaunchConfig.type) {
if (this._shellLaunchConfig.type === 'Task') {
return nls.localize('terminalTypeTask', "Task");
} else {
return nls.localize('terminalTypeLocal', "Local");
}
}
return undefined;
}
get userHome(): string | undefined { return this._userHome; }

// The onExit event is special in that it fires and is disposed after the terminal instance
// itself is disposed
private readonly _onExit = new Emitter<number | undefined>();
readonly onExit = this._onExit.event;

private readonly _onDisposed = this._register(new Emitter<ITerminalInstance>());
readonly onDisposed = this._onDisposed.event;
private readonly _onProcessIdReady = this._register(new Emitter<ITerminalInstance>());
Expand Down Expand Up @@ -2273,10 +2272,10 @@ export class TerminalLabelComputer extends Disposable {
cwd: this._instance.cwd || this._instance.initialCwd || '',
cwdFolder: '',
workspaceFolder: this._instance.workspaceFolder,
local: this._instance.shellLaunchConfig.description === 'Local' ? 'Local' : undefined,
local: this._instance.shellLaunchConfig.type === 'Local' ? this._instance.shellLaunchConfig.type : undefined,
process: this._instance.processName,
sequence: this._instance.sequence,
task: this._instance.shellLaunchConfig.description === 'Task' ? 'Task' : undefined,
task: this._instance.shellLaunchConfig.type === 'Task' ? this._instance.shellLaunchConfig.type : undefined,
fixedDimensions: this._instance.fixedCols
? (this._instance.fixedRows ? `\u2194${this._instance.fixedCols} \u2195${this._instance.fixedRows}` : `\u2194${this._instance.fixedCols}`)
: (this._instance.fixedRows ? `\u2195${this._instance.fixedRows}` : ''),
Expand Down
4 changes: 2 additions & 2 deletions src/vs/workbench/contrib/terminal/browser/terminalService.ts
Expand Up @@ -1074,10 +1074,10 @@ export class TerminalService implements ITerminalService {
if (typeof shellLaunchConfig.cwd !== 'string' && shellLaunchConfig.cwd?.scheme === Schemas.file) {
if (VirtualWorkspaceContext.getValue(this._contextKeyService)) {
shellLaunchConfig.initialText = formatMessageForTerminal(nls.localize('localTerminalVirtualWorkspace', "⚠ : This shell is open to a {0}local{1} folder, NOT to the virtual folder", '\x1b[3m', '\x1b[23m'), true);
shellLaunchConfig.description = nls.localize('localTerminalDescription', "Local");
shellLaunchConfig.type = 'Local';
} else if (this._remoteAgentService.getConnection()) {
shellLaunchConfig.initialText = formatMessageForTerminal(nls.localize('localTerminalRemote', "⚠ : This shell is running on your {0}local{1} machine, NOT on the connected remote machine", '\x1b[3m', '\x1b[23m'), true);
shellLaunchConfig.description = nls.localize('localTerminalDescription', "Local");
shellLaunchConfig.type = 'Local';
}
}
}
Expand Down
Expand Up @@ -233,7 +233,7 @@ suite('Workbench - TerminalInstance', () => {
test('should resolve local', () => {
configurationService = new TestConfigurationService({ terminal: { integrated: { tabs: { separator: ' - ', title: '${local}', description: '${local}' } } } });
configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!);
terminalLabelComputer = new TerminalLabelComputer(configHelper, createInstance({ capabilities, processName: 'zsh', shellLaunchConfig: { description: 'Local' } }), mockContextService);
terminalLabelComputer = new TerminalLabelComputer(configHelper, createInstance({ capabilities, processName: 'zsh', shellLaunchConfig: { type: 'Local' } }), mockContextService);
terminalLabelComputer.refreshLabel();
strictEqual(terminalLabelComputer.title, 'Local');
strictEqual(terminalLabelComputer.description, 'Local');
Expand All @@ -257,15 +257,15 @@ suite('Workbench - TerminalInstance', () => {
test('should resolve task', () => {
configurationService = new TestConfigurationService({ terminal: { integrated: { tabs: { separator: ' ~ ', title: '${process}${separator}${task}', description: '${task}' } } } });
configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!);
terminalLabelComputer = new TerminalLabelComputer(configHelper, createInstance({ capabilities, processName: 'zsh', shellLaunchConfig: { description: 'Task' } }), mockContextService);
terminalLabelComputer = new TerminalLabelComputer(configHelper, createInstance({ capabilities, processName: 'zsh', shellLaunchConfig: { type: 'Task' } }), mockContextService);
terminalLabelComputer.refreshLabel();
strictEqual(terminalLabelComputer.title, 'zsh ~ Task');
strictEqual(terminalLabelComputer.description, 'Task');
});
test('should resolve separator', () => {
configurationService = new TestConfigurationService({ terminal: { integrated: { tabs: { separator: ' ~ ', title: '${separator}', description: '${separator}' } } } });
configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!);
terminalLabelComputer = new TerminalLabelComputer(configHelper, createInstance({ capabilities, processName: 'zsh', shellLaunchConfig: { description: 'Task' } }), mockContextService);
terminalLabelComputer = new TerminalLabelComputer(configHelper, createInstance({ capabilities, processName: 'zsh', shellLaunchConfig: { type: 'Task' } }), mockContextService);
terminalLabelComputer.refreshLabel();
strictEqual(terminalLabelComputer.title, 'zsh');
strictEqual(terminalLabelComputer.description, '');
Expand Down