diff --git a/src/vs/workbench/api/browser/mainThreadTerminalService.ts b/src/vs/workbench/api/browser/mainThreadTerminalService.ts index 49ad9f65a50..428f24124f6 100644 --- a/src/vs/workbench/api/browser/mainThreadTerminalService.ts +++ b/src/vs/workbench/api/browser/mainThreadTerminalService.ts @@ -70,7 +70,6 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape this._toDispose.add(_terminalService.onInstanceRequestStartExtensionTerminal(e => this._onRequestStartExtensionTerminal(e))); this._toDispose.add(_terminalService.onActiveInstanceChanged(instance => this._onActiveTerminalChanged(instance ? instance.instanceId : null))); this._toDispose.add(_terminalService.onInstanceTitleChanged(instance => instance && this._onTitleChanged(instance.instanceId, instance.title))); - this._toDispose.add(_terminalService.configHelper.onWorkspacePermissionsChanged(isAllowed => this._onWorkspacePermissionsChanged(isAllowed))); this._toDispose.add(_terminalService.onRequestAvailableProfiles(e => this._onRequestAvailableProfiles(e))); // ITerminalInstanceService listeners @@ -209,10 +208,6 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape this._proxy.$acceptTerminalTitleChange(terminalId, name); } - private _onWorkspacePermissionsChanged(isAllowed: boolean): void { - this._proxy.$acceptWorkspacePermissionsChanged(isAllowed); - } - private _onTerminalDisposed(terminalInstance: ITerminalInstance): void { this._proxy.$acceptTerminalClosed(terminalInstance.instanceId, terminalInstance.exitCode); } diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 8d2b7126b29..ea3e035b202 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -1718,7 +1718,6 @@ export interface ExtHostTerminalServiceShape { $acceptProcessRequestInitialCwd(id: number): void; $acceptProcessRequestCwd(id: number): void; $acceptProcessRequestLatency(id: number): number; - $acceptWorkspacePermissionsChanged(isAllowed: boolean): void; $getAvailableProfiles(configuredProfilesOnly: boolean): Promise; $getDefaultShellAndArgs(useAutomationShell: boolean): Promise; $provideLinks(id: number, line: string): Promise; diff --git a/src/vs/workbench/api/common/extHostTerminalService.ts b/src/vs/workbench/api/common/extHostTerminalService.ts index 01b3d87a346..a10d6b973b4 100644 --- a/src/vs/workbench/api/common/extHostTerminalService.ts +++ b/src/vs/workbench/api/common/extHostTerminalService.ts @@ -336,7 +336,6 @@ export abstract class BaseExtHostTerminalService extends Disposable implements I public abstract getDefaultShellArgs(useAutomationShell: boolean, configProvider: ExtHostConfigProvider): string[] | string; public abstract $getAvailableProfiles(configuredProfilesOnly: boolean): Promise; public abstract $getDefaultShellAndArgs(useAutomationShell: boolean): Promise; - public abstract $acceptWorkspacePermissionsChanged(isAllowed: boolean): void; public createExtensionTerminal(options: vscode.ExtensionTerminalOptions): vscode.Terminal { const terminal = new ExtHostTerminal(this._proxy, generateUuid(), options, options.name); @@ -791,8 +790,4 @@ export class WorkerExtHostTerminalService extends BaseExtHostTerminalService { public async $getDefaultShellAndArgs(useAutomationShell: boolean): Promise { throw new NotSupportedError(); } - - public $acceptWorkspacePermissionsChanged(isAllowed: boolean): void { - throw new NotSupportedError(); - } } diff --git a/src/vs/workbench/api/node/extHostTerminalService.ts b/src/vs/workbench/api/node/extHostTerminalService.ts index 8f58c1c96c3..b3d7108569b 100644 --- a/src/vs/workbench/api/node/extHostTerminalService.ts +++ b/src/vs/workbench/api/node/extHostTerminalService.ts @@ -27,8 +27,6 @@ export class ExtHostTerminalService extends BaseExtHostTerminalService { private _variableResolverPromise: Promise; private _lastActiveWorkspace: IWorkspaceFolder | undefined; - // TODO: Pull this from main side - private _isWorkspaceShellAllowed: boolean = false; private _defaultShell: string | undefined; constructor( @@ -77,16 +75,14 @@ export class ExtHostTerminalService extends BaseExtHostTerminalService { } public getDefaultShell(useAutomationShell: boolean, configProvider: ExtHostConfigProvider): string { - const fetchSetting = (key: string): { userValue: string | string[] | undefined, value: string | string[] | undefined, defaultValue: string | string[] | undefined } => { - const setting = configProvider + const fetchSetting = (key: string): string | undefined => { + return configProvider .getConfiguration(key.substr(0, key.lastIndexOf('.'))) - .inspect(key.substr(key.lastIndexOf('.') + 1)); - return this._apiInspectConfigToPlain(setting); + .get(key.substr(key.lastIndexOf('.') + 1)); }; return terminalEnvironment.getDefaultShell( fetchSetting, - this._isWorkspaceShellAllowed, this._defaultShell ?? getSystemShellSync(platform.platform, process.env as platform.IProcessEnvironment), process.env.hasOwnProperty('PROCESSOR_ARCHITEW6432'), process.env.windir, @@ -97,24 +93,13 @@ export class ExtHostTerminalService extends BaseExtHostTerminalService { } public getDefaultShellArgs(useAutomationShell: boolean, configProvider: ExtHostConfigProvider): string[] | string { - const fetchSetting = (key: string): { userValue: string | string[] | undefined, value: string | string[] | undefined, defaultValue: string | string[] | undefined } => { - const setting = configProvider + const fetchSetting = (key: string): string | string[] | undefined => { + return configProvider .getConfiguration(key.substr(0, key.lastIndexOf('.'))) - .inspect(key.substr(key.lastIndexOf('.') + 1)); - return this._apiInspectConfigToPlain(setting); + .get(key.substr(key.lastIndexOf('.') + 1)); }; - return terminalEnvironment.getDefaultShellArgs(fetchSetting, this._isWorkspaceShellAllowed, useAutomationShell, terminalEnvironment.createVariableResolver(this._lastActiveWorkspace, this._variableResolver), this._logService); - } - - private _apiInspectConfigToPlain( - config: { key: string; defaultValue?: T; globalValue?: T; workspaceValue?: T, workspaceFolderValue?: T } | undefined - ): { userValue: T | undefined, value: T | undefined, defaultValue: T | undefined } { - return { - userValue: config ? config.globalValue : undefined, - value: config ? config.workspaceValue : undefined, - defaultValue: config ? config.defaultValue : undefined, - }; + return terminalEnvironment.getDefaultShellArgs(fetchSetting, useAutomationShell, terminalEnvironment.createVariableResolver(this._lastActiveWorkspace, this._variableResolver), this._logService); } private _registerListeners(): void { @@ -150,8 +135,4 @@ export class ExtHostTerminalService extends BaseExtHostTerminalService { args: this.getDefaultShellArgs(useAutomationShell, configProvider) }; } - - public $acceptWorkspacePermissionsChanged(isAllowed: boolean): void { - this._isWorkspaceShellAllowed = isAllowed; - } } diff --git a/src/vs/workbench/contrib/terminal/browser/remoteTerminalService.ts b/src/vs/workbench/contrib/terminal/browser/remoteTerminalService.ts index c625196f25a..b6140cd8653 100644 --- a/src/vs/workbench/contrib/terminal/browser/remoteTerminalService.ts +++ b/src/vs/workbench/contrib/terminal/browser/remoteTerminalService.ts @@ -146,14 +146,12 @@ export class RemoteTerminalService extends Disposable implements IRemoteTerminal cwd: shellLaunchConfig.cwd, env: shellLaunchConfig.env }; - const isWorkspaceShellAllowed = configHelper.checkIsProcessLaunchSafe(remoteEnv.os); const result = await this._remoteTerminalChannel.createProcess( shellLaunchConfigDto, activeWorkspaceRootUri, shouldPersist, cols, rows, - isWorkspaceShellAllowed, ); const pty = new RemotePty(result.persistentTerminalId, shouldPersist, this._remoteTerminalChannel, this._remoteAgentService, this._logService); this._ptys.set(result.persistentTerminalId, pty); diff --git a/src/vs/workbench/contrib/terminal/browser/terminal.ts b/src/vs/workbench/contrib/terminal/browser/terminal.ts index 9bbdab37a08..70200684b54 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminal.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminal.ts @@ -179,7 +179,6 @@ export interface ITerminalService { getTabForInstance(instance: ITerminalInstance): ITerminalTab | undefined; setContainers(panelContainer: HTMLElement, terminalContainer: HTMLElement): void; - manageWorkspaceShellPermissions(): void; /** * Injects native Windows functionality into the service. diff --git a/src/vs/workbench/contrib/terminal/browser/terminalActions.ts b/src/vs/workbench/contrib/terminal/browser/terminalActions.ts index c58a308e72f..0ea82068505 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalActions.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalActions.ts @@ -616,20 +616,6 @@ export function registerTerminalActions() { } } }); - registerAction2(class extends Action2 { - constructor() { - super({ - id: TERMINAL_COMMAND_ID.MANAGE_WORKSPACE_SHELL_PERMISSIONS, - title: { value: localize('workbench.action.terminal.manageWorkspaceShellPermissions', "Manage Workspace Shell Permissions"), original: 'Manage Workspace Shell Permissions' }, - f1: true, - category, - precondition: KEYBINDING_CONTEXT_TERMINAL_PROCESS_SUPPORTED - }); - } - run(accessor: ServicesAccessor) { - accessor.get(ITerminalService).manageWorkspaceShellPermissions(); - } - }); registerAction2(class extends Action2 { constructor() { super({ @@ -1557,11 +1543,8 @@ export function registerTerminalActions() { if (quickSelectProfiles) { const profile = quickSelectProfiles.find(profile => profile.profileName === profileSelection); if (profile) { - const workspaceShellAllowed = terminalService.configHelper.checkIsProcessLaunchSafe(undefined, profile); - if (workspaceShellAllowed) { - const instance = terminalService.createTerminal(profile); - terminalService.setActiveInstance(instance); - } + const instance = terminalService.createTerminal(profile); + terminalService.setActiveInstance(instance); } else { console.warn(`No profile with name "${profileSelection}"`); } diff --git a/src/vs/workbench/contrib/terminal/browser/terminalConfigHelper.ts b/src/vs/workbench/contrib/terminal/browser/terminalConfigHelper.ts index cbde1c98f18..f3709c4abe0 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalConfigHelper.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalConfigHelper.ts @@ -7,8 +7,7 @@ import * as nls from 'vs/nls'; import * as platform from 'vs/base/common/platform'; import { EDITOR_FONT_DEFAULTS, IEditorOptions } from 'vs/editor/common/config/editorOptions'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage'; -import { ITerminalConfiguration, ITerminalFont, IS_WORKSPACE_SHELL_ALLOWED_STORAGE_KEY, TERMINAL_CONFIG_SECTION, DEFAULT_LETTER_SPACING, DEFAULT_LINE_HEIGHT, MINIMUM_LETTER_SPACING, LinuxDistro, MINIMUM_FONT_WEIGHT, MAXIMUM_FONT_WEIGHT, DEFAULT_FONT_WEIGHT, DEFAULT_BOLD_FONT_WEIGHT, FontWeight, ITerminalProfile } from 'vs/workbench/contrib/terminal/common/terminal'; +import { ITerminalConfiguration, TERMINAL_CONFIG_SECTION, DEFAULT_LETTER_SPACING, DEFAULT_LINE_HEIGHT, MINIMUM_LETTER_SPACING, LinuxDistro, MINIMUM_FONT_WEIGHT, MAXIMUM_FONT_WEIGHT, DEFAULT_FONT_WEIGHT, DEFAULT_BOLD_FONT_WEIGHT, FontWeight, ITerminalFont } from 'vs/workbench/contrib/terminal/common/terminal'; import Severity from 'vs/base/common/severity'; import { INotificationService, NeverShowAgainScope } from 'vs/platform/notification/common/notification'; import { IBrowserTerminalConfigHelper } from 'vs/workbench/contrib/terminal/browser/terminal'; @@ -37,9 +36,6 @@ export class TerminalConfigHelper implements IBrowserTerminalConfigHelper { private _linuxDistro: LinuxDistro = LinuxDistro.Unknown; public config!: ITerminalConfiguration; - private readonly _onWorkspacePermissionsChanged = new Emitter(); - public get onWorkspacePermissionsChanged(): Event { return this._onWorkspacePermissionsChanged.event; } - private readonly _onConfigChanged = new Emitter(); public get onConfigChanged(): Event { return this._onConfigChanged.event; } @@ -47,7 +43,6 @@ export class TerminalConfigHelper implements IBrowserTerminalConfigHelper { @IConfigurationService private readonly _configurationService: IConfigurationService, @IExtensionManagementService private readonly _extensionManagementService: IExtensionManagementService, @INotificationService private readonly _notificationService: INotificationService, - @IStorageService private readonly _storageService: IStorageService, @ITelemetryService private readonly telemetryService: ITelemetryService, @IInstantiationService private readonly instantiationService: IInstantiationService, @IProductService private readonly productService: IProductService, @@ -205,86 +200,6 @@ export class TerminalConfigHelper implements IBrowserTerminalConfigHelper { return this._measureFont(fontFamily, fontSize, letterSpacing, lineHeight); } - public setWorkspaceShellAllowed(isAllowed: boolean): void { - this._onWorkspacePermissionsChanged.fire(isAllowed); - this._storageService.store(IS_WORKSPACE_SHELL_ALLOWED_STORAGE_KEY, isAllowed, StorageScope.WORKSPACE, StorageTarget.MACHINE); - } - - public isWorkspaceShellAllowed(defaultValue: boolean | undefined = undefined): boolean | undefined { - return this._storageService.getBoolean(IS_WORKSPACE_SHELL_ALLOWED_STORAGE_KEY, StorageScope.WORKSPACE, defaultValue); - } - - public checkIsProcessLaunchSafe(osOverride: platform.OperatingSystem = platform.OS, profile?: ITerminalProfile): boolean { - // Check whether there is a workspace setting - const platformKey = osOverride === platform.OperatingSystem.Windows ? 'windows' : osOverride === platform.OperatingSystem.Macintosh ? 'osx' : 'linux'; - const shellConfigValue = this._configurationService.inspect(`terminal.integrated.shell.${platformKey}`); - const shellArgsConfigValue = this._configurationService.inspect(`terminal.integrated.shellArgs.${platformKey}`); - const envConfigValue = this._configurationService.inspect<{ [key: string]: string }>(`terminal.integrated.env.${platformKey}`); - - // Check if the workspace terminals are allowed: - // - undefined: Unknown - always ask - // - false: Disallowed - never ask - // - true: Allowed - never ask - let isTerminalLaunchSafe: boolean | undefined = false; - - // Check whether the shell is defined in workspace settings - const workspaceDefinedShell = profile?.isWorkspaceProfile ? profile.path : shellConfigValue.workspaceValue; - - // Check whether the shell args is defined in workspace settings - let workspaceDefinedShellArgs = profile?.isWorkspaceProfile ? profile.args : shellArgsConfigValue.workspaceValue; - if (typeof workspaceDefinedShellArgs === 'string') { - workspaceDefinedShellArgs = [workspaceDefinedShellArgs]; - } - - // Check whether the environment is defined in workspace settings - const workspaceDefinedEnv = envConfigValue.workspaceValue; - - // Return safe if no workspace settings are used - if ( - workspaceDefinedShell === undefined && - workspaceDefinedShellArgs === undefined && - workspaceDefinedEnv === undefined - ) { - return true; - } - - // Check whether the user has already been prompted about this workspace's permissions - isTerminalLaunchSafe = this.isWorkspaceShellAllowed(undefined); - - // If the user has already answered, return the response - if (isTerminalLaunchSafe !== undefined) { - return isTerminalLaunchSafe; - } - - // Format string message for workspace settings, note that this is not localized because - // they reference settings keys - const shellString = workspaceDefinedShell ? `shell: "${workspaceDefinedShell}"` : undefined; - const argsString = workspaceDefinedShellArgs ? `shellArgs: [${workspaceDefinedShellArgs.map(v => '"' + v + '"').join(', ')}]` : undefined; - const envString = workspaceDefinedEnv ? `env: {${Object.keys(workspaceDefinedEnv).map(k => `${k}:${workspaceDefinedEnv![k]}`).join(', ')}}` : undefined; - const workspaceConfigStrings: string[] = []; - if (shellString) { workspaceConfigStrings.push(shellString); } - if (argsString) { workspaceConfigStrings.push(argsString); } - if (envString) { workspaceConfigStrings.push(envString); } - const workspaceConfigString = workspaceConfigStrings.join(', '); - - // Ask the user's permissions whether to allow or disallow this workspace and remember their - // selection - this._notificationService.prompt(Severity.Info, nls.localize('terminal.integrated.allowWorkspaceShell', "Do you allow this workspace to modify your terminal shell? {0}", workspaceConfigString), - [{ - label: nls.localize('allow', "Allow"), - run: () => this.setWorkspaceShellAllowed(true) - }, - { - label: nls.localize('disallow', "Disallow"), - run: () => this.setWorkspaceShellAllowed(false) - }] - ); - - // TODO: We should await this instead when trusted workspaces modal is adopted - // Always return false when asking, since we don't await the notification - return false; - } - private _clampInt(source: any, minimum: number, maximum: number, fallback: T): number | T { let r = parseInt(source, 10); if (isNaN(r)) { diff --git a/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.ts b/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.ts index 20ca84b9a72..9f2808915ba 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.ts @@ -118,7 +118,7 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce @ILogService private readonly _logService: ILogService, @IWorkspaceContextService private readonly _workspaceContextService: IWorkspaceContextService, @IConfigurationResolverService private readonly _configurationResolverService: IConfigurationResolverService, - @IConfigurationService private readonly _workspaceConfigurationService: IConfigurationService, + @IConfigurationService private readonly _configurationService: IConfigurationService, @IWorkbenchEnvironmentService private readonly _environmentService: IWorkbenchEnvironmentService, @IProductService private readonly _productService: IProductService, @ITerminalInstanceService private readonly _terminalInstanceService: ITerminalInstanceService, @@ -335,14 +335,13 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce private async _setupEnvVariableInfo(activeWorkspaceRootUri: URI | undefined, shellLaunchConfig: IShellLaunchConfig): Promise { const platformKey = platform.isWindows ? 'windows' : (platform.isMacintosh ? 'osx' : 'linux'); const lastActiveWorkspace = activeWorkspaceRootUri ? withNullAsUndefined(this._workspaceContextService.getWorkspaceFolder(activeWorkspaceRootUri)) : undefined; - const envFromConfigValue = this._workspaceConfigurationService.inspect(`terminal.integrated.env.${platformKey}`); - const isWorkspaceShellAllowed = this._configHelper.checkIsProcessLaunchSafe(); + const envFromConfigValue = this._configurationService.getValue(`terminal.integrated.env.${platformKey}`); this._configHelper.showRecommendations(shellLaunchConfig); const baseEnv = await (this._configHelper.config.inheritEnv ? this._terminalProfileResolverService.getShellEnvironment() : this._terminalInstanceService.getMainProcessParentEnv()); const variableResolver = terminalEnvironment.createVariableResolver(lastActiveWorkspace, this._configurationResolverService); - const env = terminalEnvironment.createTerminalEnvironment(shellLaunchConfig, envFromConfigValue, variableResolver, isWorkspaceShellAllowed, this._productService.version, this._configHelper.config.detectLocale, baseEnv); + const env = terminalEnvironment.createTerminalEnvironment(shellLaunchConfig, envFromConfigValue, variableResolver, this._productService.version, this._configHelper.config.detectLocale, baseEnv); if (!shellLaunchConfig.strictEnv && !shellLaunchConfig.hideFromUser) { this._extEnvironmentVariableCollection = this._environmentVariableService.mergedCollection; diff --git a/src/vs/workbench/contrib/terminal/browser/terminalService.ts b/src/vs/workbench/contrib/terminal/browser/terminalService.ts index 3a742acec8b..336d661b50c 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalService.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalService.ts @@ -753,16 +753,6 @@ export class TerminalService implements ITerminalService { return terminalIndex; } - public async manageWorkspaceShellPermissions(): Promise { - const allowItem: IQuickPickItem = { label: nls.localize('workbench.action.terminal.allowWorkspaceShell', "Allow Workspace Shell Configuration") }; - const disallowItem: IQuickPickItem = { label: nls.localize('workbench.action.terminal.disallowWorkspaceShell', "Disallow Workspace Shell Configuration") }; - const value = await this._quickInputService.pick([allowItem, disallowItem], { canPickMany: false }); - if (!value) { - return; - } - this.configHelper.setWorkspaceShellAllowed(value === allowItem); - } - protected async _showTerminalCloseConfirmation(): Promise { let message: string; if (this.terminalInstances.length === 1) { diff --git a/src/vs/workbench/contrib/terminal/common/remoteTerminalChannel.ts b/src/vs/workbench/contrib/terminal/common/remoteTerminalChannel.ts index b51d6fa6dd6..385319c469e 100644 --- a/src/vs/workbench/contrib/terminal/common/remoteTerminalChannel.ts +++ b/src/vs/workbench/contrib/terminal/common/remoteTerminalChannel.ts @@ -25,25 +25,19 @@ import { Platform } from 'vs/base/common/platform'; export const REMOTE_TERMINAL_CHANNEL_NAME = 'remoteterminal'; -export interface ISingleTerminalConfiguration { - userValue: T | undefined; - value: T | undefined; - defaultValue: T | undefined; -} - export interface ICompleteTerminalConfiguration { - 'terminal.integrated.automationShell.windows': ISingleTerminalConfiguration; - 'terminal.integrated.automationShell.osx': ISingleTerminalConfiguration; - 'terminal.integrated.automationShell.linux': ISingleTerminalConfiguration; - 'terminal.integrated.shell.windows': ISingleTerminalConfiguration; - 'terminal.integrated.shell.osx': ISingleTerminalConfiguration; - 'terminal.integrated.shell.linux': ISingleTerminalConfiguration; - 'terminal.integrated.shellArgs.windows': ISingleTerminalConfiguration; - 'terminal.integrated.shellArgs.osx': ISingleTerminalConfiguration; - 'terminal.integrated.shellArgs.linux': ISingleTerminalConfiguration; - 'terminal.integrated.env.windows': ISingleTerminalConfiguration; - 'terminal.integrated.env.osx': ISingleTerminalConfiguration; - 'terminal.integrated.env.linux': ISingleTerminalConfiguration; + 'terminal.integrated.automationShell.windows': string; + 'terminal.integrated.automationShell.osx': string; + 'terminal.integrated.automationShell.linux': string; + 'terminal.integrated.shell.windows': string; + 'terminal.integrated.shell.osx': string; + 'terminal.integrated.shell.linux': string; + 'terminal.integrated.shellArgs.windows': string | string[]; + 'terminal.integrated.shellArgs.osx': string | string[]; + 'terminal.integrated.shellArgs.linux': string | string[]; + 'terminal.integrated.env.windows': ITerminalEnvironment; + 'terminal.integrated.env.osx': ITerminalEnvironment; + 'terminal.integrated.env.linux': ITerminalEnvironment; 'terminal.integrated.inheritEnv': boolean; 'terminal.integrated.cwd': string; 'terminal.integrated.detectLocale': 'auto' | 'off' | 'on'; @@ -70,7 +64,6 @@ export interface ICreateTerminalProcessArguments { shouldPersistTerminal: boolean; cols: number; rows: number; - isWorkspaceShellAllowed: boolean; resolverEnv: { [key: string]: string | null; } | undefined } @@ -140,37 +133,28 @@ export class RemoteTerminalChannelClient { @ILabelService private readonly _labelService: ILabelService, ) { } - private _readSingleTerminalConfiguration(key: string): ISingleTerminalConfiguration { - const result = this._configurationService.inspect(key); - return { - userValue: result.userValue, - value: result.value, - defaultValue: result.defaultValue, - }; - } - restartPtyHost(): Promise { return this._channel.call('$restartPtyHost', []); } - public async createProcess(shellLaunchConfig: IShellLaunchConfigDto, activeWorkspaceRootUri: URI | undefined, shouldPersistTerminal: boolean, cols: number, rows: number, isWorkspaceShellAllowed: boolean): Promise { + public async createProcess(shellLaunchConfig: IShellLaunchConfigDto, activeWorkspaceRootUri: URI | undefined, shouldPersistTerminal: boolean, cols: number, rows: number): Promise { // Be sure to first wait for the remote configuration await this._configurationService.whenRemoteConfigurationLoaded(); const terminalConfig = this._configurationService.getValue(TERMINAL_CONFIG_SECTION); const configuration: ICompleteTerminalConfiguration = { - 'terminal.integrated.automationShell.windows': this._readSingleTerminalConfiguration('terminal.integrated.automationShell.windows'), - 'terminal.integrated.automationShell.osx': this._readSingleTerminalConfiguration('terminal.integrated.automationShell.osx'), - 'terminal.integrated.automationShell.linux': this._readSingleTerminalConfiguration('terminal.integrated.automationShell.linux'), - 'terminal.integrated.shell.windows': this._readSingleTerminalConfiguration('terminal.integrated.shell.windows'), - 'terminal.integrated.shell.osx': this._readSingleTerminalConfiguration('terminal.integrated.shell.osx'), - 'terminal.integrated.shell.linux': this._readSingleTerminalConfiguration('terminal.integrated.shell.linux'), - 'terminal.integrated.shellArgs.windows': this._readSingleTerminalConfiguration('terminal.integrated.shellArgs.windows'), - 'terminal.integrated.shellArgs.osx': this._readSingleTerminalConfiguration('terminal.integrated.shellArgs.osx'), - 'terminal.integrated.shellArgs.linux': this._readSingleTerminalConfiguration('terminal.integrated.shellArgs.linux'), - 'terminal.integrated.env.windows': this._readSingleTerminalConfiguration('terminal.integrated.env.windows'), - 'terminal.integrated.env.osx': this._readSingleTerminalConfiguration('terminal.integrated.env.osx'), - 'terminal.integrated.env.linux': this._readSingleTerminalConfiguration('terminal.integrated.env.linux'), + 'terminal.integrated.automationShell.windows': this._configurationService.getValue('terminal.integrated.automationShell.windows'), + 'terminal.integrated.automationShell.osx': this._configurationService.getValue('terminal.integrated.automationShell.osx'), + 'terminal.integrated.automationShell.linux': this._configurationService.getValue('terminal.integrated.automationShell.linux'), + 'terminal.integrated.shell.windows': this._configurationService.getValue('terminal.integrated.shell.windows'), + 'terminal.integrated.shell.osx': this._configurationService.getValue('terminal.integrated.shell.osx'), + 'terminal.integrated.shell.linux': this._configurationService.getValue('terminal.integrated.shell.linux'), + 'terminal.integrated.shellArgs.windows': this._configurationService.getValue('terminal.integrated.shellArgs.windows'), + 'terminal.integrated.shellArgs.osx': this._configurationService.getValue('terminal.integrated.shellArgs.osx'), + 'terminal.integrated.shellArgs.linux': this._configurationService.getValue('terminal.integrated.shellArgs.linux'), + 'terminal.integrated.env.windows': this._configurationService.getValue('terminal.integrated.env.windows'), + 'terminal.integrated.env.osx': this._configurationService.getValue('terminal.integrated.env.osx'), + 'terminal.integrated.env.linux': this._configurationService.getValue('terminal.integrated.env.linux'), 'terminal.integrated.inheritEnv': terminalConfig.inheritEnv, 'terminal.integrated.cwd': terminalConfig.cwd, 'terminal.integrated.detectLocale': terminalConfig.detectLocale @@ -227,7 +211,6 @@ export class RemoteTerminalChannelClient { shouldPersistTerminal, cols, rows, - isWorkspaceShellAllowed, resolverEnv }; return await this._channel.call('$createProcess', args); diff --git a/src/vs/workbench/contrib/terminal/common/terminal.ts b/src/vs/workbench/contrib/terminal/common/terminal.ts index bf46005de5b..1a53302e218 100644 --- a/src/vs/workbench/contrib/terminal/common/terminal.ts +++ b/src/vs/workbench/contrib/terminal/common/terminal.ts @@ -51,7 +51,6 @@ export const KEYBINDING_CONTEXT_TERMINAL_FIND_INPUT_NOT_FOCUSED = KEYBINDING_CON export const KEYBINDING_CONTEXT_TERMINAL_PROCESS_SUPPORTED = new RawContextKey('terminalProcessSupported', false, nls.localize('terminalProcessSupportedContextKey', "Whether terminal processes can be launched")); -export const IS_WORKSPACE_SHELL_ALLOWED_STORAGE_KEY = 'terminal.integrated.isWorkspaceShellAllowed'; export const NEVER_MEASURE_RENDER_TIME_STORAGE_KEY = 'terminal.integrated.neverMeasureRenderTime'; export const TERMINAL_CREATION_COMMANDS = ['workbench.action.terminal.toggleTerminal', 'workbench.action.terminal.new', 'workbench.action.togglePanel', 'workbench.action.terminal.focus']; @@ -185,19 +184,8 @@ export const DEFAULT_LOCAL_ECHO_EXCLUDE: ReadonlyArray = ['vim', 'vi', ' export interface ITerminalConfigHelper { config: ITerminalConfiguration; - onWorkspacePermissionsChanged: Event; - configFontIsMonospace(): boolean; getFont(): ITerminalFont; - /** Sets whether a workspace shell configuration is allowed or not */ - setWorkspaceShellAllowed(isAllowed: boolean): void; - /** - * Checks and returns whether it's safe to launch the process. If the user has not yet been - * asked, ask for future calls and return false. - * @param osOverride Use a custom OS (eg. remote). - * @param profile The profile if this is launching with a profile. - */ - checkIsProcessLaunchSafe(osOverride?: OperatingSystem, profile?: ITerminalProfile): boolean; showRecommendations(shellLaunchConfig: IShellLaunchConfig): void; } @@ -463,7 +451,6 @@ export const enum TERMINAL_COMMAND_ID { SCROLL_TO_TOP = 'workbench.action.terminal.scrollToTop', CLEAR = 'workbench.action.terminal.clear', CLEAR_SELECTION = 'workbench.action.terminal.clearSelection', - MANAGE_WORKSPACE_SHELL_PERMISSIONS = 'workbench.action.terminal.manageWorkspaceShellPermissions', RENAME = 'workbench.action.terminal.rename', RENAME_WITH_ARG = 'workbench.action.terminal.renameWithArg', FIND_FOCUS = 'workbench.action.terminal.focusFind', diff --git a/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts b/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts index 63742c01932..be2f284c63c 100644 --- a/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts +++ b/src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts @@ -59,6 +59,7 @@ export const terminalConfiguration: IConfigurationNode = { default: false }, 'terminal.integrated.automationShell.linux': { + requireTrust: true, markdownDescription: localize({ key: 'terminal.integrated.automationShell.linux', comment: ['{0} and {1} are the `shell` and `shellArgs` settings keys'] @@ -67,6 +68,7 @@ export const terminalConfiguration: IConfigurationNode = { default: null }, 'terminal.integrated.automationShell.osx': { + requireTrust: true, markdownDescription: localize({ key: 'terminal.integrated.automationShell.osx', comment: ['{0} and {1} are the `shell` and `shellArgs` settings keys'] @@ -75,6 +77,7 @@ export const terminalConfiguration: IConfigurationNode = { default: null }, 'terminal.integrated.automationShell.windows': { + requireTrust: true, markdownDescription: localize({ key: 'terminal.integrated.automationShell.windows', comment: ['{0} and {1} are the `shell` and `shellArgs` settings keys'] @@ -83,6 +86,7 @@ export const terminalConfiguration: IConfigurationNode = { default: null }, 'terminal.integrated.shellArgs.linux': { + requireTrust: 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', items: { @@ -91,6 +95,7 @@ export const terminalConfiguration: IConfigurationNode = { default: [] }, 'terminal.integrated.shellArgs.osx': { + requireTrust: 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', items: { @@ -102,6 +107,7 @@ export const terminalConfiguration: IConfigurationNode = { default: ['-l'] }, 'terminal.integrated.shellArgs.windows': { + requireTrust: 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': [ { @@ -119,6 +125,7 @@ export const terminalConfiguration: IConfigurationNode = { default: [] }, 'terminal.integrated.profiles.windows': { + requireTrust: true, markdownDescription: localize( { key: 'terminal.integrated.profiles.windows', @@ -178,6 +185,7 @@ export const terminalConfiguration: IConfigurationNode = { } }, 'terminal.integrated.profiles.osx': { + requireTrust: true, markdownDescription: localize( { key: 'terminal.integrated.profile.osx', @@ -213,6 +221,7 @@ export const terminalConfiguration: IConfigurationNode = { } }, 'terminal.integrated.profiles.linux': { + requireTrust: true, markdownDescription: localize( { key: 'terminal.integrated.profile.linux', @@ -477,6 +486,7 @@ export const terminalConfiguration: IConfigurationNode = { default: true }, 'terminal.integrated.env.osx': { + requireTrust: 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', additionalProperties: { @@ -485,6 +495,7 @@ export const terminalConfiguration: IConfigurationNode = { default: {} }, 'terminal.integrated.env.linux': { + requireTrust: 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', additionalProperties: { @@ -493,6 +504,7 @@ export const terminalConfiguration: IConfigurationNode = { default: {} }, 'terminal.integrated.env.windows': { + requireTrust: 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', additionalProperties: { @@ -614,16 +626,19 @@ function getTerminalShellConfigurationStub(linux: string, osx: string, windows: type: 'object', properties: { 'terminal.integrated.shell.linux': { + requireTrust: true, markdownDescription: linux, type: ['string', 'null'], default: null }, 'terminal.integrated.shell.osx': { + requireTrust: true, markdownDescription: osx, type: ['string', 'null'], default: null }, 'terminal.integrated.shell.windows': { + requireTrust: true, markdownDescription: windows, type: ['string', 'null'], default: null diff --git a/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts b/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts index a8128844eae..0ed01f0af25 100644 --- a/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts +++ b/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts @@ -11,7 +11,6 @@ import { IConfigurationResolverService } from 'vs/workbench/services/configurati 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 { IConfigurationOverrides } from 'vs/platform/configuration/common/configuration'; /** * This module contains utility functions related to the environment, cwd and paths. @@ -275,8 +274,7 @@ export function createVariableResolver(lastActiveWorkspace: IWorkspaceFolder | u * @deprecated Use ITerminalProfileResolverService */ export function getDefaultShell( - fetchSetting: (key: TerminalShellSetting) => { userValue?: string | string[], value?: string | string[], defaultValue?: string | string[] }, - isWorkspaceShellAllowed: boolean, + fetchSetting: (key: TerminalShellSetting) => string | undefined, defaultShell: string, isWoW64: boolean, windir: string | undefined, @@ -285,13 +283,13 @@ export function getDefaultShell( useAutomationShell: boolean, platformOverride: platform.Platform = platform.platform ): string { - let maybeExecutable: string | null = null; + let maybeExecutable: string | undefined; if (useAutomationShell) { // If automationShell is specified, this should override the normal setting - maybeExecutable = getShellSetting(fetchSetting, isWorkspaceShellAllowed, 'automationShell', platformOverride); + maybeExecutable = getShellSetting(fetchSetting, 'automationShell', platformOverride) as string | undefined; } if (!maybeExecutable) { - maybeExecutable = getShellSetting(fetchSetting, isWorkspaceShellAllowed, 'shell', platformOverride); + maybeExecutable = getShellSetting(fetchSetting, 'shell', platformOverride) as string | undefined; } let executable: string = maybeExecutable || defaultShell; @@ -325,22 +323,20 @@ export function getDefaultShell( * @deprecated Use ITerminalProfileResolverService */ export function getDefaultShellArgs( - fetchSetting: (key: TerminalShellSetting | TerminalShellArgsSetting) => { userValue?: string | string[], value?: string | string[], defaultValue?: string | string[] }, - isWorkspaceShellAllowed: boolean, + fetchSetting: (key: TerminalShellSetting | TerminalShellArgsSetting) => string | string[] | undefined, useAutomationShell: boolean, variableResolver: VariableResolver | undefined, logService: ILogService, platformOverride: platform.Platform = platform.platform, ): string | string[] { if (useAutomationShell) { - if (!!getShellSetting(fetchSetting, isWorkspaceShellAllowed, 'automationShell', platformOverride)) { + if (!!getShellSetting(fetchSetting, 'automationShell', platformOverride)) { return []; } } const platformKey = platformOverride === platform.Platform.Windows ? 'windows' : platformOverride === platform.Platform.Mac ? 'osx' : 'linux'; - const shellArgsConfigValue = fetchSetting(`terminal.integrated.shellArgs.${platformKey}`); - let args = ((isWorkspaceShellAllowed ? shellArgsConfigValue.value : shellArgsConfigValue.userValue) || shellArgsConfigValue.defaultValue); + let args = fetchSetting(`terminal.integrated.shellArgs.${platformKey}`); if (!args) { return []; } @@ -363,22 +359,18 @@ export function getDefaultShellArgs( } function getShellSetting( - fetchSetting: (key: TerminalShellSetting) => { userValue?: string | string[], value?: string | string[], defaultValue?: string | string[] }, - isWorkspaceShellAllowed: boolean, + fetchSetting: (key: TerminalShellSetting) => string | string[] | undefined, type: 'automationShell' | 'shell', platformOverride: platform.Platform = platform.platform, -): string | null { +): string | string[] | undefined { const platformKey = platformOverride === platform.Platform.Windows ? 'windows' : platformOverride === platform.Platform.Mac ? 'osx' : 'linux'; - const shellConfigValue = fetchSetting(`terminal.integrated.${type}.${platformKey}`); - const executable = (isWorkspaceShellAllowed ? shellConfigValue.value : shellConfigValue.userValue) || (shellConfigValue.defaultValue); - return executable; + return fetchSetting(`terminal.integrated.${type}.${platformKey}`); } export function createTerminalEnvironment( shellLaunchConfig: IShellLaunchConfig, - envFromConfig: { userValue?: ITerminalEnvironment, value?: ITerminalEnvironment, defaultValue?: ITerminalEnvironment }, + envFromConfig: ITerminalEnvironment | undefined, variableResolver: VariableResolver | undefined, - isWorkspaceShellAllowed: boolean, version: string | undefined, detectLocale: 'auto' | 'off' | 'on', baseEnv: platform.IProcessEnvironment @@ -392,9 +384,7 @@ export function createTerminalEnvironment( // Merge process env with the env from config and from shellLaunchConfig mergeNonNullKeys(env, baseEnv); - // const platformKey = platform.isWindows ? 'windows' : (platform.isMacintosh ? 'osx' : 'linux'); - // const envFromConfigValue = this._workspaceConfigurationService.inspect(`terminal.integrated.env.${platformKey}`); - const allowedEnvFromConfig = { ...(isWorkspaceShellAllowed ? envFromConfig.value : envFromConfig.userValue) }; + const allowedEnvFromConfig = { ...envFromConfig }; // Resolve env vars from config and shell if (variableResolver) { @@ -419,18 +409,3 @@ export function createTerminalEnvironment( } return env; } - -// namespace Profile { -export interface IResolvedProfile { - shell: string; - shellArgs: string; - env: ITerminalEnvironment; -} - -export function resolveDefaultProfile(configProvider: IConfigProvider) { -} -// } - -interface IConfigProvider { - inspect(key: string, overrides?: IConfigurationOverrides): { userValue: T | undefined, value: T | undefined, defaultValue: T | undefined }; -} 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 2a717e05cee..1f1a4da2775 100644 --- a/src/vs/workbench/contrib/terminal/test/browser/terminalConfigHelper.test.ts +++ b/src/vs/workbench/contrib/terminal/test/browser/terminalConfigHelper.test.ts @@ -20,7 +20,7 @@ suite('Workbench - TerminalConfigHelper', () => { const configurationService = new TestConfigurationService(); await configurationService.setUserConfiguration('editor', { fontFamily: 'foo' }); await configurationService.setUserConfiguration('terminal', { integrated: { fontFamily: 'bar' } }); - const configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!, null!); + const configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.strictEqual(configHelper.getFont().fontFamily, 'bar', 'terminal.integrated.fontFamily should be selected over editor.fontFamily'); }); @@ -29,7 +29,7 @@ suite('Workbench - TerminalConfigHelper', () => { const configurationService = new TestConfigurationService(); await configurationService.setUserConfiguration('editor', { fontFamily: 'foo' }); await configurationService.setUserConfiguration('terminal', { integrated: { fontFamily: null } }); - const configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!, null!); + const configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!); configHelper.setLinuxDistro(LinuxDistro.Fedora); configHelper.panelContainer = fixture; assert.strictEqual(configHelper.getFont().fontFamily, '\'DejaVu Sans Mono\', monospace', 'Fedora should have its font overridden when terminal.integrated.fontFamily not set'); @@ -39,7 +39,7 @@ suite('Workbench - TerminalConfigHelper', () => { const configurationService = new TestConfigurationService(); await configurationService.setUserConfiguration('editor', { fontFamily: 'foo' }); await configurationService.setUserConfiguration('terminal', { integrated: { fontFamily: null } }); - const configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!, null!); + const configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!); configHelper.setLinuxDistro(LinuxDistro.Ubuntu); configHelper.panelContainer = fixture; assert.strictEqual(configHelper.getFont().fontFamily, '\'Ubuntu Mono\', monospace', 'Ubuntu should have its font overridden when terminal.integrated.fontFamily not set'); @@ -49,7 +49,7 @@ suite('Workbench - TerminalConfigHelper', () => { const configurationService = new TestConfigurationService(); await configurationService.setUserConfiguration('editor', { fontFamily: 'foo' }); await configurationService.setUserConfiguration('terminal', { integrated: { fontFamily: null } }); - const configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!, null!); + const configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.strictEqual(configHelper.getFont().fontFamily, 'foo', 'editor.fontFamily should be the fallback when terminal.integrated.fontFamily not set'); }); @@ -67,7 +67,7 @@ suite('Workbench - TerminalConfigHelper', () => { fontSize: 10 } }); - let configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!, null!); + let configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.strictEqual(configHelper.getFont().fontSize, 10, 'terminal.integrated.fontSize should be selected over editor.fontSize'); @@ -80,12 +80,12 @@ suite('Workbench - TerminalConfigHelper', () => { fontSize: 0 } }); - configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!, null!); + configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!); configHelper.setLinuxDistro(LinuxDistro.Ubuntu); configHelper.panelContainer = fixture; assert.strictEqual(configHelper.getFont().fontSize, 8, 'The minimum terminal font size (with adjustment) should be used when terminal.integrated.fontSize less than it'); - configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!, null!); + configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.strictEqual(configHelper.getFont().fontSize, 6, 'The minimum terminal font size should be used when terminal.integrated.fontSize less than it'); @@ -98,7 +98,7 @@ suite('Workbench - TerminalConfigHelper', () => { fontSize: 1500 } }); - configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!, null!); + configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.strictEqual(configHelper.getFont().fontSize, 25, 'The maximum terminal font size should be used when terminal.integrated.fontSize more than it'); @@ -111,12 +111,12 @@ suite('Workbench - TerminalConfigHelper', () => { fontSize: null } }); - configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!, null!); + configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!); configHelper.setLinuxDistro(LinuxDistro.Ubuntu); configHelper.panelContainer = fixture; assert.strictEqual(configHelper.getFont().fontSize, EDITOR_FONT_DEFAULTS.fontSize + 2, 'The default editor font size (with adjustment) should be used when terminal.integrated.fontSize is not set'); - configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!, null!); + configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.strictEqual(configHelper.getFont().fontSize, EDITOR_FONT_DEFAULTS.fontSize, 'The default editor font size should be used when terminal.integrated.fontSize is not set'); }); @@ -134,7 +134,7 @@ suite('Workbench - TerminalConfigHelper', () => { lineHeight: 2 } }); - let configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!, null!); + let configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.strictEqual(configHelper.getFont().lineHeight, 2, 'terminal.integrated.lineHeight should be selected over editor.lineHeight'); @@ -148,7 +148,7 @@ suite('Workbench - TerminalConfigHelper', () => { lineHeight: 0 } }); - configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!, null!); + configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.strictEqual(configHelper.getFont().lineHeight, 1, 'editor.lineHeight should be 1 when terminal.integrated.lineHeight not set'); }); @@ -161,7 +161,7 @@ suite('Workbench - TerminalConfigHelper', () => { } }); - let configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!, null!); + let configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.strictEqual(configHelper.configFontIsMonospace(), true, 'monospace is monospaced'); }); @@ -173,7 +173,7 @@ suite('Workbench - TerminalConfigHelper', () => { fontFamily: 'sans-serif' } }); - let configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!, null!); + let configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.strictEqual(configHelper.configFontIsMonospace(), false, 'sans-serif is not monospaced'); }); @@ -185,7 +185,7 @@ suite('Workbench - TerminalConfigHelper', () => { fontFamily: 'serif' } }); - let configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!, null!); + let configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.strictEqual(configHelper.configFontIsMonospace(), false, 'serif is not monospaced'); }); @@ -201,7 +201,7 @@ suite('Workbench - TerminalConfigHelper', () => { } }); - let configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!, null!); + let configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.strictEqual(configHelper.configFontIsMonospace(), true, 'monospace is monospaced'); }); @@ -217,7 +217,7 @@ suite('Workbench - TerminalConfigHelper', () => { } }); - let configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!, null!); + let configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.strictEqual(configHelper.configFontIsMonospace(), false, 'sans-serif is not monospaced'); }); @@ -233,7 +233,7 @@ suite('Workbench - TerminalConfigHelper', () => { } }); - let configHelper = new TerminalConfigHelper(configurationService, null!, null!, null!, null!, null!, null!); + let configHelper = new TerminalConfigHelper(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/terminalEnvironment.test.ts b/src/vs/workbench/contrib/terminal/test/common/terminalEnvironment.test.ts index bdf2e2eca2a..68723146423 100644 --- a/src/vs/workbench/contrib/terminal/test/common/terminalEnvironment.test.ts +++ b/src/vs/workbench/contrib/terminal/test/common/terminalEnvironment.test.ts @@ -215,7 +215,7 @@ suite('Workbench - TerminalEnvironment', () => { return ({ 'terminal.integrated.shell.windows': { userValue: 'C:\\Windows\\Sysnative\\cmd.exe', value: undefined, defaultValue: undefined } } as any)[key]; - }, false, 'DEFAULT', false, 'C:\\Windows', undefined, {} as any, false, platform.Platform.Windows); + }, 'DEFAULT', false, 'C:\\Windows', undefined, {} as any, false, platform.Platform.Windows); assert.strictEqual(shell, 'C:\\Windows\\System32\\cmd.exe'); }); @@ -224,7 +224,7 @@ suite('Workbench - TerminalEnvironment', () => { return ({ 'terminal.integrated.shell.windows': { userValue: 'C:\\Windows\\Sysnative\\cmd.exe', value: undefined, defaultValue: undefined } } as any)[key]; - }, false, 'DEFAULT', true, 'C:\\Windows', undefined, {} as any, false, platform.Platform.Windows); + }, 'DEFAULT', true, 'C:\\Windows', undefined, {} as any, false, platform.Platform.Windows); assert.strictEqual(shell, 'C:\\Windows\\Sysnative\\cmd.exe'); }); @@ -234,21 +234,21 @@ suite('Workbench - TerminalEnvironment', () => { 'terminal.integrated.shell.windows': { userValue: 'shell', value: undefined, defaultValue: undefined }, 'terminal.integrated.automationShell.windows': { userValue: undefined, value: undefined, defaultValue: undefined } } as any)[key]; - }, false, 'DEFAULT', false, 'C:\\Windows', undefined, {} as any, false, platform.Platform.Windows); + }, 'DEFAULT', false, 'C:\\Windows', undefined, {} as any, false, platform.Platform.Windows); assert.strictEqual(shell1, 'shell', 'automationShell was false'); const shell2 = getDefaultShell(key => { return ({ 'terminal.integrated.shell.windows': { userValue: 'shell', value: undefined, defaultValue: undefined }, 'terminal.integrated.automationShell.windows': { userValue: undefined, value: undefined, defaultValue: undefined } } as any)[key]; - }, false, 'DEFAULT', false, 'C:\\Windows', undefined, {} as any, true, platform.Platform.Windows); + }, 'DEFAULT', false, 'C:\\Windows', undefined, {} as any, true, platform.Platform.Windows); assert.strictEqual(shell2, 'shell', 'automationShell was true'); const shell3 = getDefaultShell(key => { return ({ 'terminal.integrated.shell.windows': { userValue: 'shell', value: undefined, defaultValue: undefined }, 'terminal.integrated.automationShell.windows': { userValue: 'automationShell', value: undefined, defaultValue: undefined } } as any)[key]; - }, false, 'DEFAULT', false, 'C:\\Windows', undefined, {} as any, true, platform.Platform.Windows); + }, 'DEFAULT', false, 'C:\\Windows', undefined, {} as any, true, platform.Platform.Windows); assert.strictEqual(shell3, 'automationShell', 'automationShell was true and specified in settings'); }); });