Skip to content

Commit

Permalink
Revert "fix #141686"
Browse files Browse the repository at this point in the history
This reverts commit 4af3e14

Didn't seem to fix the issue
  • Loading branch information
Tyriar committed Jan 28, 2022
1 parent d4e08c8 commit 22fc043
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
5 changes: 0 additions & 5 deletions src/vs/platform/terminal/common/terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -503,11 +503,6 @@ export interface IShellLaunchConfig {
* Opt-out of the default terminal persistence on restart and reload
*/
disablePersistence?: boolean;

/**
* This is a split terminal that inherited its parent's cwd
*/
splitInheritedCwd?: boolean;
}

export interface ICreateContributedTerminalProfileOptions {
Expand Down
7 changes: 3 additions & 4 deletions src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1232,7 +1232,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
// Set the initial name based on the _resolved_ shell launch config, this will also
// ensure the resolved icon gets shown
if (!this._labelComputer) {
this._labelComputer = this._register(new TerminalLabelComputer(this._configHelper, this, this._workspaceContextService, this.shellLaunchConfig.splitInheritedCwd));
this._labelComputer = this._register(new TerminalLabelComputer(this._configHelper, this, this._workspaceContextService));
this._labelComputer.onDidChangeLabel(e => {
this._title = e.title;
this._description = e.description;
Expand Down Expand Up @@ -2257,8 +2257,7 @@ export class TerminalLabelComputer extends Disposable {
constructor(
private readonly _configHelper: TerminalConfigHelper,
private readonly _instance: Pick<ITerminalInstance, 'shellLaunchConfig' | 'cwd' | 'fixedCols' | 'fixedRows' | 'initialCwd' | 'processName' | 'sequence' | 'userHome' | 'workspaceFolder' | 'staticTitle' | 'capabilities' | 'title' | 'description'>,
@IWorkspaceContextService private readonly _workspaceContextService: IWorkspaceContextService,
private readonly _splitInheritedCwd?: boolean
@IWorkspaceContextService private readonly _workspaceContextService: IWorkspaceContextService
) {
super();
}
Expand Down Expand Up @@ -2299,7 +2298,7 @@ export class TerminalLabelComputer extends Disposable {
const detection = this._instance.capabilities.has(TerminalCapability.CwdDetection) || this._instance.capabilities.has(TerminalCapability.NaiveCwdDetection);
const zeroRootWorkspace = this._workspaceContextService.getWorkspace().folders.length === 0 && this.pathsEqual(templateProperties.cwd, this._instance.userHome || this._configHelper.config.cwd);
const singleRootWorkspace = this._workspaceContextService.getWorkspace().folders.length === 1 && this.pathsEqual(templateProperties.cwd, this._configHelper.config.cwd || this._workspaceContextService.getWorkspace().folders[0]?.uri.fsPath);
if ((this._instance.cwd !== this._instance.initialCwd) || this._splitInheritedCwd) {
if (this._instance.cwd !== this._instance.initialCwd) {
templateProperties.cwdFolder = (!templateProperties.cwd || !detection || zeroRootWorkspace || singleRootWorkspace) ? '' : path.basename(templateProperties.cwd);
}

Expand Down
6 changes: 2 additions & 4 deletions src/vs/workbench/contrib/terminal/browser/terminalService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@ export class TerminalService implements ITerminalService {

const splitActiveTerminal = typeof options?.location === 'object' && 'splitActiveTerminal' in options.location ? options.location.splitActiveTerminal : typeof options?.location === 'object' ? 'parentTerminal' in options.location : false;

shellLaunchConfig.splitInheritedCwd = await this._resolveCwd(shellLaunchConfig, splitActiveTerminal, options);
this._resolveCwd(shellLaunchConfig, splitActiveTerminal, options);

// Launch the contributed profile
if (contributedProfile) {
Expand Down Expand Up @@ -975,7 +975,7 @@ export class TerminalService implements ITerminalService {
return this._createTerminal(shellLaunchConfig, location, options);
}

private async _resolveCwd(shellLaunchConfig: IShellLaunchConfig, splitActiveTerminal: boolean, options?: ICreateTerminalOptions): Promise<boolean | undefined> {
private async _resolveCwd(shellLaunchConfig: IShellLaunchConfig, splitActiveTerminal: boolean, options?: ICreateTerminalOptions): Promise<void> {
let cwd = shellLaunchConfig.cwd;
if (!cwd) {
if (options?.cwd) {
Expand All @@ -989,10 +989,8 @@ export class TerminalService implements ITerminalService {
throw new Error('Cannot split without an active instance');
}
shellLaunchConfig.cwd = await getCwdForSplit(this.configHelper, parent, this._workspaceContextService.getWorkspace().folders, this._commandService);
return !!shellLaunchConfig.cwd;
}
}
return undefined;
}

private _splitTerminal(shellLaunchConfig: IShellLaunchConfig, location: TerminalLocation, parent: ITerminalInstance): ITerminalInstance {
Expand Down

0 comments on commit 22fc043

Please sign in to comment.