Merge pull request #124752 from microsoft/tyriar/term_trust
Support workspace trust in terminal
This commit is contained in:
commit
394a1ce2db
8 changed files with 56 additions and 114 deletions
|
@ -85,7 +85,6 @@ export const enum TerminalSettingId {
|
|||
LocalEchoExcludePrograms = 'terminal.integrated.localEchoExcludePrograms',
|
||||
LocalEchoStyle = 'terminal.integrated.localEchoStyle',
|
||||
EnablePersistentSessions = 'terminal.integrated.enablePersistentSessions',
|
||||
AllowWorkspaceConfiguration = 'terminal.integrated.allowWorkspaceConfiguration',
|
||||
InheritEnv = 'terminal.integrated.inheritEnv'
|
||||
}
|
||||
|
||||
|
@ -583,8 +582,6 @@ export interface ITerminalDimensionsOverride extends Readonly<ITerminalDimension
|
|||
forceExactSize?: boolean;
|
||||
}
|
||||
|
||||
export type SafeConfigProvider = <T>(key: string) => T | undefined;
|
||||
|
||||
export const enum ProfileSource {
|
||||
GitBash = 'Git Bash',
|
||||
Pwsh = 'PowerShell'
|
||||
|
|
|
@ -296,12 +296,6 @@ const terminalPlatformConfiguration: IConfigurationNode = {
|
|||
type: 'boolean',
|
||||
default: true
|
||||
},
|
||||
[TerminalSettingId.AllowWorkspaceConfiguration]: {
|
||||
scope: ConfigurationScope.APPLICATION,
|
||||
description: localize('terminal.integrated.allowWorkspaceConfiguration', "Allows shell and profile settings to be pick up from a workspace."),
|
||||
type: 'boolean',
|
||||
default: false
|
||||
},
|
||||
[TerminalSettingId.InheritEnv]: {
|
||||
scope: ConfigurationScope.APPLICATION,
|
||||
description: localize('terminal.integrated.inheritEnv', "Whether new shells should inherit their environment from VS Code which may source a login shell to ensure $PATH and other development variables are initialized. This has no effect on Windows."),
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
import { Disposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IPtyService, IProcessDataEvent, IShellLaunchConfig, ITerminalDimensionsOverride, ITerminalLaunchError, ITerminalsLayoutInfo, TerminalIpcChannels, IHeartbeatService, HeartbeatConstants, TerminalShellType, ITerminalProfile, IRequestResolveVariablesEvent, SafeConfigProvider, TerminalSettingId, TitleEventSource, TerminalIcon, IReconnectConstants } from 'vs/platform/terminal/common/terminal';
|
||||
import { IPtyService, IProcessDataEvent, IShellLaunchConfig, ITerminalDimensionsOverride, ITerminalLaunchError, ITerminalsLayoutInfo, TerminalIpcChannels, IHeartbeatService, HeartbeatConstants, TerminalShellType, ITerminalProfile, IRequestResolveVariablesEvent, TitleEventSource, TerminalIcon, IReconnectConstants } from 'vs/platform/terminal/common/terminal';
|
||||
import { Client } from 'vs/base/parts/ipc/node/ipc.cp';
|
||||
import { FileAccess } from 'vs/base/common/network';
|
||||
import { ProxyChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
|
@ -223,7 +223,7 @@ export class PtyHostService extends Disposable implements IPtyService {
|
|||
return this._proxy.getDefaultSystemShell(osOverride);
|
||||
}
|
||||
async getProfiles(includeDetectedProfiles: boolean = false): Promise<ITerminalProfile[]> {
|
||||
return detectAvailableProfiles(includeDetectedProfiles, this._buildSafeConfigProvider(), undefined, this._logService, this._resolveVariables.bind(this));
|
||||
return detectAvailableProfiles(includeDetectedProfiles, this._configurationService, undefined, this._logService, this._resolveVariables.bind(this));
|
||||
}
|
||||
getEnvironment(): Promise<IProcessEnvironment> {
|
||||
return this._proxy.getEnvironment();
|
||||
|
@ -326,21 +326,4 @@ export class PtyHostService extends Disposable implements IPtyService {
|
|||
this._logService.warn(`Resolved variables received without matching request ${id}`);
|
||||
}
|
||||
}
|
||||
|
||||
private _buildSafeConfigProvider(): SafeConfigProvider {
|
||||
return (key: string) => {
|
||||
const isWorkspaceConfigAllowed = this._configurationService.getValue(TerminalSettingId.AllowWorkspaceConfiguration);
|
||||
if (isWorkspaceConfigAllowed) {
|
||||
return this._configurationService.getValue(key) as any;
|
||||
}
|
||||
const inspected = this._configurationService.inspect(key);
|
||||
if (!inspected) {
|
||||
return undefined;
|
||||
}
|
||||
if (inspected.userValue && typeof inspected.userValue === 'object' && inspected.defaultValue && typeof inspected.defaultValue === 'object') {
|
||||
return { ...inspected.defaultValue, ...inspected.userValue };
|
||||
}
|
||||
return inspected?.userValue || inspected?.defaultValue;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,17 +9,18 @@ import { findExecutable, getWindowsBuildNumber } from 'vs/platform/terminal/node
|
|||
import * as cp from 'child_process';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import * as pfs from 'vs/base/node/pfs';
|
||||
import { ITerminalEnvironment, ITerminalProfile, ITerminalProfileObject, ProfileSource, SafeConfigProvider, TerminalSettingId } from 'vs/platform/terminal/common/terminal';
|
||||
import { ITerminalEnvironment, ITerminalProfile, ITerminalProfileObject, ProfileSource, TerminalSettingId } from 'vs/platform/terminal/common/terminal';
|
||||
import { Codicon } from 'vs/base/common/codicons';
|
||||
import { isMacintosh, isWindows } from 'vs/base/common/platform';
|
||||
import { ThemeIcon } from 'vs/platform/theme/common/themeService';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
|
||||
let profileSources: Map<string, IPotentialTerminalProfile> | undefined;
|
||||
|
||||
export function detectAvailableProfiles(
|
||||
includeDetectedProfiles: boolean,
|
||||
safeConfigProvider: SafeConfigProvider,
|
||||
configurationService: IConfigurationService,
|
||||
fsProvider?: IFsProvider,
|
||||
logService?: ILogService,
|
||||
variableResolver?: (text: string[]) => Promise<string[]>,
|
||||
|
@ -34,9 +35,9 @@ export function detectAvailableProfiles(
|
|||
includeDetectedProfiles,
|
||||
fsProvider,
|
||||
logService,
|
||||
safeConfigProvider<boolean>(TerminalSettingId.UseWslProfiles) !== false,
|
||||
safeConfigProvider(TerminalSettingId.ProfilesWindows),
|
||||
safeConfigProvider(TerminalSettingId.DefaultProfileWindows),
|
||||
configurationService.getValue<boolean>(TerminalSettingId.UseWslProfiles) !== false,
|
||||
configurationService.getValue(TerminalSettingId.ProfilesWindows),
|
||||
configurationService.getValue(TerminalSettingId.DefaultProfileWindows),
|
||||
testPaths,
|
||||
variableResolver
|
||||
);
|
||||
|
@ -45,8 +46,8 @@ export function detectAvailableProfiles(
|
|||
fsProvider,
|
||||
logService,
|
||||
includeDetectedProfiles,
|
||||
safeConfigProvider(isMacintosh ? TerminalSettingId.ProfilesMacOs : TerminalSettingId.ProfilesLinux),
|
||||
safeConfigProvider(isMacintosh ? TerminalSettingId.DefaultProfileMacOs : TerminalSettingId.DefaultProfileLinux),
|
||||
configurationService.getValue(isMacintosh ? TerminalSettingId.ProfilesMacOs : TerminalSettingId.ProfilesLinux),
|
||||
configurationService.getValue(isMacintosh ? TerminalSettingId.DefaultProfileMacOs : TerminalSettingId.DefaultProfileLinux),
|
||||
testPaths,
|
||||
variableResolver
|
||||
);
|
||||
|
|
|
@ -26,7 +26,7 @@ import { IProcessDataEvent, IShellLaunchConfig, ITerminalChildProcess, ITerminal
|
|||
import { TerminalRecorder } from 'vs/platform/terminal/common/terminalRecorder';
|
||||
import { localize } from 'vs/nls';
|
||||
import { formatMessageForTerminal } from 'vs/workbench/contrib/terminal/common/terminalStrings';
|
||||
import { IProcessEnvironment, OperatingSystem, OS } from 'vs/base/common/platform';
|
||||
import { IProcessEnvironment, isMacintosh, isWindows, OperatingSystem, OS } from 'vs/base/common/platform';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { ICompleteTerminalConfiguration } from 'vs/workbench/contrib/terminal/common/remoteTerminalChannel';
|
||||
|
||||
|
@ -240,19 +240,19 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce
|
|||
});
|
||||
const terminalConfig = this._configurationService.getValue<ITerminalConfiguration>(TERMINAL_CONFIG_SECTION);
|
||||
const configuration: ICompleteTerminalConfiguration = {
|
||||
'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.automationShell.windows': this._configurationService.getValue(TerminalSettingId.AutomationShellWindows) as string,
|
||||
'terminal.integrated.automationShell.osx': this._configurationService.getValue(TerminalSettingId.AutomationShellMacOs) as string,
|
||||
'terminal.integrated.automationShell.linux': this._configurationService.getValue(TerminalSettingId.AutomationShellLinux) as string,
|
||||
'terminal.integrated.shell.windows': this._configurationService.getValue(TerminalSettingId.ShellWindows) as string,
|
||||
'terminal.integrated.shell.osx': this._configurationService.getValue(TerminalSettingId.ShellMacOs) as string,
|
||||
'terminal.integrated.shell.linux': this._configurationService.getValue(TerminalSettingId.ShellLinux) as string,
|
||||
'terminal.integrated.shellArgs.windows': this._configurationService.getValue(TerminalSettingId.ShellArgsWindows) as string | string[],
|
||||
'terminal.integrated.shellArgs.osx': this._configurationService.getValue(TerminalSettingId.ShellArgsMacOs) as string | string[],
|
||||
'terminal.integrated.shellArgs.linux': this._configurationService.getValue(TerminalSettingId.ShellArgsLinux) as string | string[],
|
||||
'terminal.integrated.env.windows': this._configurationService.getValue(TerminalSettingId.EnvWindows) as ITerminalEnvironment,
|
||||
'terminal.integrated.env.osx': this._configurationService.getValue(TerminalSettingId.EnvMacOs) as ITerminalEnvironment,
|
||||
'terminal.integrated.env.linux': this._configurationService.getValue(TerminalSettingId.EnvLinux) as ITerminalEnvironment,
|
||||
'terminal.integrated.cwd': this._configurationService.getValue(TerminalSettingId.Cwd) as string,
|
||||
'terminal.integrated.detectLocale': terminalConfig.detectLocale
|
||||
};
|
||||
newProcess = await this._remoteTerminalService.createProcess(shellLaunchConfig, configuration, activeWorkspaceRootUri, cols, rows, shouldPersist, this._configHelper);
|
||||
|
@ -354,9 +354,8 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce
|
|||
|
||||
// Fetch any extension environment additions and apply them
|
||||
private async _setupEnvVariableInfo(variableResolver: terminalEnvironment.VariableResolver | undefined, shellLaunchConfig: IShellLaunchConfig): Promise<IProcessEnvironment> {
|
||||
// const platformKey = isWindows ? 'windows' : (isMacintosh ? 'osx' : 'linux');
|
||||
// this._configurationService.getValue<ITerminalEnvironment | undefined>(`terminal.integrated.env.${platformKey}`);
|
||||
const envFromConfigValue = this._terminalProfileResolverService.getSafeConfigValue('env', OS) as ITerminalEnvironment | undefined;
|
||||
const platformKey = isWindows ? 'windows' : (isMacintosh ? 'osx' : 'linux');
|
||||
const envFromConfigValue = this._configurationService.getValue<ITerminalEnvironment | undefined>(`terminal.integrated.env.${platformKey}`);
|
||||
this._configHelper.showRecommendations(shellLaunchConfig);
|
||||
|
||||
let baseEnv: IProcessEnvironment;
|
||||
|
|
|
@ -205,7 +205,7 @@ export abstract class BaseTerminalProfileResolverService implements ITerminalPro
|
|||
}
|
||||
|
||||
private _getUnresolvedRealDefaultProfile(os: OperatingSystem): ITerminalProfile | undefined {
|
||||
const defaultProfileName = this.getSafeConfigValue('defaultProfile', os);
|
||||
const defaultProfileName = this._configurationService.getValue(`terminal.integrated.defaultProfile.${this._getOsKey(os)}`);
|
||||
if (defaultProfileName && typeof defaultProfileName === 'string') {
|
||||
return this._terminalService.availableProfiles.find(e => e.profileName === defaultProfileName);
|
||||
}
|
||||
|
@ -213,9 +213,13 @@ export abstract class BaseTerminalProfileResolverService implements ITerminalPro
|
|||
}
|
||||
|
||||
private async _getUnresolvedShellSettingDefaultProfile(options: IShellLaunchConfigResolveOptions): Promise<ITerminalProfile | undefined> {
|
||||
let executable = this.getSafeConfigValue('shell', options.os) as string | null;
|
||||
if (!this._isValidShell(executable) && !this.getSafeConfigValue('shellArgs', options.os, false)) {
|
||||
return undefined;
|
||||
let executable = this._configurationService.getValue<string>(`terminal.integrated.shell.${this._getOsKey(options.os)}`);
|
||||
if (!this._isValidShell(executable)) {
|
||||
const shellArgs = this._configurationService.inspect(`terminal.integrated.shellArgs.${this._getOsKey(options.os)}`);
|
||||
// && !this.getSafeConfigValue('shellArgs', options.os, false)) {
|
||||
if (!shellArgs.userValue && !shellArgs.workspaceValue) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
if (!executable || !this._isValidShell(executable)) {
|
||||
|
@ -223,7 +227,7 @@ export abstract class BaseTerminalProfileResolverService implements ITerminalPro
|
|||
}
|
||||
|
||||
let args: string | string[] | undefined;
|
||||
const shellArgsSetting = this.getSafeConfigValue('shellArgs', options.os);
|
||||
const shellArgsSetting = this._configurationService.getValue(`terminal.integrated.shellArgs.${this._getOsKey(options.os)}`);
|
||||
if (this._isValidShellArgs(shellArgsSetting, options.os)) {
|
||||
args = shellArgsSetting;
|
||||
}
|
||||
|
@ -279,7 +283,7 @@ export abstract class BaseTerminalProfileResolverService implements ITerminalPro
|
|||
}
|
||||
|
||||
private _getUnresolvedAutomationShellProfile(options: IShellLaunchConfigResolveOptions): ITerminalProfile | undefined {
|
||||
const automationShell = this.getSafeConfigValue('automationShell', options.os);
|
||||
const automationShell = this._configurationService.getValue(`terminal.integrated.automationShell.${this._getOsKey(options.os)}`);
|
||||
if (!automationShell || typeof automationShell !== 'string') {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -385,32 +389,6 @@ export abstract class BaseTerminalProfileResolverService implements ITerminalPro
|
|||
return false;
|
||||
}
|
||||
|
||||
// TODO: Remove when workspace trust is enabled
|
||||
getSafeConfigValue(key: string, os: OperatingSystem, useDefaultValue: boolean = true): unknown | undefined {
|
||||
return this.getSafeConfigValueFullKey(`terminal.integrated.${key}.${this._getOsKey(os)}`, useDefaultValue);
|
||||
}
|
||||
getSafeConfigValueFullKey(key: string, useDefaultValue: boolean = true): unknown | undefined {
|
||||
const isWorkspaceConfigAllowed = this._configurationService.getValue(TerminalSettingId.AllowWorkspaceConfiguration);
|
||||
const config = this._configurationService.inspect(key);
|
||||
let value: unknown | undefined;
|
||||
if (isWorkspaceConfigAllowed) {
|
||||
value = config.user?.value || config.workspace?.value;
|
||||
} else {
|
||||
value = config.user?.value;
|
||||
}
|
||||
if (value === undefined && useDefaultValue) {
|
||||
value = config.default?.value;
|
||||
}
|
||||
// Clone if needed to allow extensibility
|
||||
if (Array.isArray(value)) {
|
||||
return value.slice();
|
||||
}
|
||||
if (value !== null && typeof value === 'object') {
|
||||
return { ...value };
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
async createProfileFromShellAndShellArgs(shell?: unknown, shellArgs?: unknown): Promise<ITerminalProfile | undefined> {
|
||||
const detectedProfile = this._terminalService.availableProfiles?.find(p => p.path === shell);
|
||||
const fallbackProfile = (await this.getDefaultProfile({
|
||||
|
|
|
@ -110,10 +110,6 @@ export interface ITerminalProfileResolverService {
|
|||
getDefaultShell(options: IShellLaunchConfigResolveOptions): Promise<string>;
|
||||
getDefaultShellArgs(options: IShellLaunchConfigResolveOptions): Promise<string | string[]>;
|
||||
getEnvironment(remoteAuthority: string | undefined): Promise<IProcessEnvironment>;
|
||||
|
||||
// TODO: Remove when workspace trust is enabled
|
||||
getSafeConfigValue(key: string, os: OperatingSystem): unknown | undefined;
|
||||
getSafeConfigValueFullKey(key: string): unknown | undefined;
|
||||
createProfileFromShellAndShellArgs(shell?: unknown, shellArgs?: unknown): Promise<ITerminalProfile | undefined>;
|
||||
}
|
||||
|
||||
|
@ -209,7 +205,6 @@ export interface ITerminalConfiguration {
|
|||
focusMode: 'singleClick' | 'doubleClick';
|
||||
},
|
||||
bellDuration: number;
|
||||
allowWorkspaceConfiguration: boolean;
|
||||
}
|
||||
|
||||
export const DEFAULT_LOCAL_ECHO_EXCLUDE: ReadonlyArray<string> = ['vim', 'vi', 'nano', 'tmux'];
|
||||
|
|
|
@ -5,9 +5,10 @@
|
|||
|
||||
import { deepStrictEqual, fail, ok, strictEqual } from 'assert';
|
||||
import { isWindows } from 'vs/base/common/platform';
|
||||
import { ITerminalProfile, ProfileSource, SafeConfigProvider } from 'vs/platform/terminal/common/terminal';
|
||||
import { ITerminalProfile, ProfileSource } from 'vs/platform/terminal/common/terminal';
|
||||
import { ITerminalConfiguration, ITerminalProfiles } from 'vs/workbench/contrib/terminal/common/terminal';
|
||||
import { detectAvailableProfiles, IFsProvider } from 'vs/platform/terminal/node/terminalProfiles';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
|
||||
/**
|
||||
* Assets that two profiles objects are equal, this will treat explicit undefined and unset
|
||||
|
@ -26,21 +27,6 @@ function profilesEqual(actualProfiles: ITerminalProfile[], expectedProfiles: ITe
|
|||
}
|
||||
}
|
||||
|
||||
function buildTestSafeConfigProvider(config: ITestTerminalConfig): SafeConfigProvider {
|
||||
return (key: string) => {
|
||||
switch (key) {
|
||||
case 'terminal.integrated.profiles.linux': return config.profiles.linux as any;
|
||||
case 'terminal.integrated.profiles.osx': return config.profiles.osx as any;
|
||||
case 'terminal.integrated.profiles.windows': return config.profiles.windows as any;
|
||||
case 'terminal.integrated.defaultProfile.linux': return Object.keys(config.profiles.linux)?.[0];
|
||||
case 'terminal.integrated.defaultProfile.osx': return Object.keys(config.profiles.osx)?.[0];
|
||||
case 'terminal.integrated.defaultProfile.windows': return Object.keys(config.profiles.windows)?.[0];
|
||||
case 'terminal.integrated.useWslProfiles': return config.useWslProfiles;
|
||||
default: throw new Error('Unexpected config key');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
suite('Workbench - TerminalProfiles', () => {
|
||||
suite('detectAvailableProfiles', () => {
|
||||
if (isWindows) {
|
||||
|
@ -58,7 +44,8 @@ suite('Workbench - TerminalProfiles', () => {
|
|||
},
|
||||
useWslProfiles: false
|
||||
};
|
||||
const profiles = await detectAvailableProfiles(false, buildTestSafeConfigProvider(config), fsProvider, undefined, undefined, undefined);
|
||||
const configurationService = new TestConfigurationService({ terminal: { integrated: config } });
|
||||
const profiles = await detectAvailableProfiles(false, configurationService, fsProvider, undefined, undefined, undefined);
|
||||
const expected = [
|
||||
{ profileName: 'Git Bash', path: 'C:\\Program Files\\Git\\bin\\bash.exe', args: ['--login'], isDefault: true }
|
||||
];
|
||||
|
@ -78,7 +65,8 @@ suite('Workbench - TerminalProfiles', () => {
|
|||
},
|
||||
useWslProfiles: false
|
||||
};
|
||||
const profiles = await detectAvailableProfiles(false, buildTestSafeConfigProvider(config), fsProvider, undefined, undefined, undefined);
|
||||
const configurationService = new TestConfigurationService({ terminal: { integrated: config } });
|
||||
const profiles = await detectAvailableProfiles(false, configurationService, fsProvider, undefined, undefined, undefined);
|
||||
const expected = [
|
||||
{ profileName: 'PowerShell', path: 'C:\\Program Files\\PowerShell\\7\\pwsh.exe', overrideName: true, args: ['-NoProfile'], isDefault: true }
|
||||
];
|
||||
|
@ -98,7 +86,8 @@ suite('Workbench - TerminalProfiles', () => {
|
|||
},
|
||||
useWslProfiles: false
|
||||
};
|
||||
const profiles = await detectAvailableProfiles(false, buildTestSafeConfigProvider(config), fsProvider, undefined, undefined, undefined);
|
||||
const configurationService = new TestConfigurationService({ terminal: { integrated: config } });
|
||||
const profiles = await detectAvailableProfiles(false, configurationService, fsProvider, undefined, undefined, undefined);
|
||||
const expected = [{ profileName: 'Git Bash', path: 'C:\\Program Files\\Git\\bin\\bash.exe', args: [], isAutoDetected: undefined, overrideName: undefined, isDefault: true }];
|
||||
profilesEqual(profiles, expected);
|
||||
});
|
||||
|
@ -120,7 +109,8 @@ suite('Workbench - TerminalProfiles', () => {
|
|||
'C:\\Sysnative\\WindowsPowerShell\\v1.0\\powershell.exe',
|
||||
'C:\\System32\\WindowsPowerShell\\v1.0\\powershell.exe'
|
||||
];
|
||||
const profiles = await detectAvailableProfiles(false, buildTestSafeConfigProvider(pwshSourceConfig), undefined, undefined, undefined, expectedPaths);
|
||||
const configurationService = new TestConfigurationService({ terminal: { integrated: pwshSourceConfig } });
|
||||
const profiles = await detectAvailableProfiles(false, configurationService, undefined, undefined, undefined, expectedPaths);
|
||||
const expected = [
|
||||
{ profileName: 'PowerShell', path: 'C:\\Program Files\\PowerShell\\7\\pwsh.exe', isDefault: true }
|
||||
];
|
||||
|
@ -133,7 +123,8 @@ suite('Workbench - TerminalProfiles', () => {
|
|||
'C:\\Sysnative\\WindowsPowerShell\\v1.0\\powershell.exe',
|
||||
'C:\\System32\\WindowsPowerShell\\v1.0\\powershell.exe'
|
||||
];
|
||||
const profiles = await detectAvailableProfiles(false, buildTestSafeConfigProvider(pwshSourceConfig), undefined, undefined, undefined, expectedPaths);
|
||||
const configurationService = new TestConfigurationService({ terminal: { integrated: pwshSourceConfig } });
|
||||
const profiles = await detectAvailableProfiles(false, configurationService, undefined, undefined, undefined, expectedPaths);
|
||||
const expected = [
|
||||
{ profileName: 'PowerShell', path: 'C:\\Program Files\\PowerShell\\7\\pwsh.exe', isDefault: true }
|
||||
];
|
||||
|
@ -144,7 +135,8 @@ suite('Workbench - TerminalProfiles', () => {
|
|||
'C:\\Windows\\Sysnative\\WindowsPowerShell\\v1.0\\powershell.exe',
|
||||
'C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe'
|
||||
];
|
||||
const profiles = await detectAvailableProfiles(false, buildTestSafeConfigProvider(pwshSourceConfig), undefined, undefined, undefined, expectedPaths);
|
||||
const configurationService = new TestConfigurationService({ terminal: { integrated: pwshSourceConfig } });
|
||||
const profiles = await detectAvailableProfiles(false, configurationService, undefined, undefined, undefined, expectedPaths);
|
||||
strictEqual(profiles.length, 1);
|
||||
strictEqual(profiles[0].profileName, 'PowerShell');
|
||||
});
|
||||
|
@ -188,7 +180,8 @@ suite('Workbench - TerminalProfiles', () => {
|
|||
'/bin/fakeshell1',
|
||||
'/bin/fakeshell3'
|
||||
]);
|
||||
const profiles = await detectAvailableProfiles(false, buildTestSafeConfigProvider(absoluteConfig), fsProvider, undefined, undefined, undefined);
|
||||
const configurationService = new TestConfigurationService({ terminal: { integrated: absoluteConfig } });
|
||||
const profiles = await detectAvailableProfiles(false, configurationService, fsProvider, undefined, undefined, undefined);
|
||||
const expected: ITerminalProfile[] = [
|
||||
{ profileName: 'fakeshell1', path: '/bin/fakeshell1', isDefault: true },
|
||||
{ profileName: 'fakeshell3', path: '/bin/fakeshell3', isDefault: true }
|
||||
|
@ -200,7 +193,8 @@ suite('Workbench - TerminalProfiles', () => {
|
|||
'/bin/fakeshell1',
|
||||
'/bin/fakeshell3'
|
||||
], '/bin/fakeshell1\n/bin/fakeshell3');
|
||||
const profiles = await detectAvailableProfiles(true, buildTestSafeConfigProvider(onPathConfig), fsProvider, undefined, undefined, undefined);
|
||||
const configurationService = new TestConfigurationService({ terminal: { integrated: onPathConfig } });
|
||||
const profiles = await detectAvailableProfiles(true, configurationService, fsProvider, undefined, undefined, undefined);
|
||||
const expected: ITerminalProfile[] = [
|
||||
{ profileName: 'fakeshell1', path: 'fakeshell1', isDefault: true },
|
||||
{ profileName: 'fakeshell3', path: 'fakeshell3', isDefault: true }
|
||||
|
@ -212,7 +206,8 @@ suite('Workbench - TerminalProfiles', () => {
|
|||
const fsProvider = createFsProvider([
|
||||
'/bin/fakeshell1'
|
||||
], '/bin/fakeshell1\n/bin/fakeshell3');
|
||||
const profiles = await detectAvailableProfiles(true, buildTestSafeConfigProvider(onPathConfig), fsProvider, undefined, undefined, undefined);
|
||||
const configurationService = new TestConfigurationService({ terminal: { integrated: onPathConfig } });
|
||||
const profiles = await detectAvailableProfiles(true, configurationService, fsProvider, undefined, undefined, undefined);
|
||||
const expected: ITerminalProfile[] = [
|
||||
{ profileName: 'fakeshell1', path: 'fakeshell1', isDefault: true }
|
||||
];
|
||||
|
|
Loading…
Reference in a new issue