diff --git a/src/vs/workbench/parts/terminal/common/terminal.ts b/src/vs/workbench/parts/terminal/common/terminal.ts index 3148eb3aaaf..c8c22a1ccd2 100644 --- a/src/vs/workbench/parts/terminal/common/terminal.ts +++ b/src/vs/workbench/parts/terminal/common/terminal.ts @@ -67,6 +67,11 @@ export interface ITerminalConfiguration { commandsToSkipShell: string[]; cwd: string; confirmOnExit: boolean; + env: { + linux: { [key: string]: string }; + osx: { [key: string]: string }; + windows: { [key: string]: string }; + }; } export interface ITerminalConfigHelper { diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts b/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts index 3995aacb60c..1759c679e1d 100644 --- a/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts +++ b/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts @@ -197,6 +197,21 @@ configurationRegistry.registerConfiguration({ DeleteWordLeftTerminalAction.ID, DeleteWordRightTerminalAction.ID ].sort() + }, + 'terminal.integrated.env.osx': { + 'description': nls.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 OS X"), + 'type': 'object', + 'default': {} + }, + 'terminal.integrated.env.linux': { + 'description': nls.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"), + 'type': 'object', + 'default': {} + }, + 'terminal.integrated.env.windows': { + 'description': nls.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"), + 'type': 'object', + 'default': {} } } }); diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts b/src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts index 2dcfd8726fa..023a152efb4 100644 --- a/src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts +++ b/src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts @@ -516,7 +516,9 @@ export class TerminalInstance implements ITerminalInstance { this._configHelper.mergeDefaultShellPathAndArgs(shell); } this._initialCwd = this._getCwd(this._shellLaunchConfig, this._historyService.getLastActiveWorkspaceRoot()); - const env = TerminalInstance.createTerminalEnv(process.env, shell, this._initialCwd, locale, this._cols, this._rows); + const platformKey = platform.isWindows ? 'windows' : platform.isMacintosh ? 'osx' : 'linux'; + const envFromConfig = { ...process.env, ...this._configHelper.config.env[platformKey] }; + const env = TerminalInstance.createTerminalEnv(envFromConfig, shell, this._initialCwd, locale, this._cols, this._rows); this._title = shell.name || ''; this._process = cp.fork(Uri.parse(require.toUrl('bootstrap')).fsPath, ['--type=terminal'], { env,