Skip to content

Commit

Permalink
Attempt to fix smoke tests
Browse files Browse the repository at this point in the history
This reverts commit be89fd2.
  • Loading branch information
Kartik Raj committed Apr 20, 2023
1 parent d3b1c67 commit 39da375
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
4 changes: 1 addition & 3 deletions src/vs/server/node/remoteTerminalChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import { IProductService } from 'vs/platform/product/common/productService';
import { IExtensionManagementService } from 'vs/platform/extensionManagement/common/extensionManagement';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { withNullAsUndefined } from 'vs/base/common/types';
import { getWorkspaceForTerminal } from 'vs/workbench/services/configurationResolver/common/terminalResolver';

class CustomVariableResolver extends AbstractVariableResolverService {
constructor(
Expand Down Expand Up @@ -239,9 +238,8 @@ export class RemoteTerminalChannel extends Disposable implements IServerChannel<
}
const envVariableCollections = new Map<string, IEnvironmentVariableCollection>(entries);
const mergedCollection = new MergedEnvironmentVariableCollection(envVariableCollections);
const cwdWorkspaceFolder = getWorkspaceForTerminal(shellLaunchConfig.cwd, args.workspaceContextService, undefined);
const workspaceFolder = activeWorkspaceFolder ? withNullAsUndefined(activeWorkspaceFolder) : undefined;
await mergedCollection.applyToProcessEnvironment(env, { workspaceFolder: cwdWorkspaceFolder ?? workspaceFolder }, variableResolver);
await mergedCollection.applyToProcessEnvironment(env, { workspaceFolder }, variableResolver);
}

// Fork the process and listen for messages
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ export interface ICreateTerminalProcessArguments {
rows: number;
unicodeVersion: '6' | '11';
resolverEnv: { [key: string]: string | null } | undefined;
// TODO: Remove this when last active workspace is fixed
workspaceContextService: IWorkspaceContextService;
}

export interface ICreateTerminalProcessResult {
Expand Down Expand Up @@ -184,8 +182,7 @@ export class RemoteTerminalChannelClient implements IPtyHostController {
cols,
rows,
unicodeVersion,
resolverEnv,
workspaceContextService: this._workspaceContextService,
resolverEnv
};
return await this._channel.call<ICreateTerminalProcessResult>('$createProcess', args);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import { URI } from 'vs/base/common/uri';
import { IWorkspaceContextService, IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
import { IHistoryService } from 'vs/workbench/services/history/common/history';

export function getWorkspaceForTerminal(cwd: URI | string | undefined, workspaceContextService: IWorkspaceContextService, historyService: IHistoryService | undefined): IWorkspaceFolder | undefined {
export function getWorkspaceForTerminal(cwd: URI | string | undefined, workspaceContextService: IWorkspaceContextService, historyService: IHistoryService): IWorkspaceFolder | undefined {
const cwdUri = typeof cwd === 'string' ? URI.parse(cwd) : cwd;
let workspaceFolder = cwdUri ? withNullAsUndefined(workspaceContextService.getWorkspaceFolder(cwdUri)) : undefined;
if (!workspaceFolder) {
// fallback to last active workspace if cwd is not available or it is not in workspace
// TOOD: last active workspace is known to be unreliable, we should remove this fallback eventually
const activeWorkspaceRootUri = historyService?.getLastActiveWorkspaceRoot();
const activeWorkspaceRootUri = historyService.getLastActiveWorkspaceRoot();
workspaceFolder = activeWorkspaceRootUri ? withNullAsUndefined(workspaceContextService.getWorkspaceFolder(activeWorkspaceRootUri)) : undefined;
}
return workspaceFolder;
Expand Down

0 comments on commit 39da375

Please sign in to comment.