未验证 提交 3560676d 编写于 作者: D Daniel Imms 提交者: GitHub

Merge pull request #38132 from cleidigh/terminal-api-cwd/add

Add cwd to createTerminal via TerminalOptions for extension API  Addresses: #37709
......@@ -5003,6 +5003,12 @@ declare module 'vscode' {
* Args for the custom shell executable, this does not work on Windows (see #8429)
*/
shellArgs?: string[];
/**
* A path for the current working directory to be used for the terminal.
*/
cwd?: string;
/**
* Object with environment variables that will be added to the VS Code process.
*/
......
......@@ -33,11 +33,12 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
// when the extension host process goes down ?
}
public $createTerminal(name?: string, shellPath?: string, shellArgs?: string[], env?: { [key: string]: string }, waitOnExit?: boolean): TPromise<number> {
public $createTerminal(name?: string, shellPath?: string, shellArgs?: string[], cwd?: string, env?: { [key: string]: string }, waitOnExit?: boolean): TPromise<number> {
const shellLaunchConfig: IShellLaunchConfig = {
name,
executable: shellPath,
args: shellArgs,
cwd,
waitOnExit,
ignoreConfigurationCwd: true,
env
......
......@@ -328,7 +328,7 @@ export interface MainThreadProgressShape extends IDisposable {
}
export interface MainThreadTerminalServiceShape extends IDisposable {
$createTerminal(name?: string, shellPath?: string, shellArgs?: string[], env?: { [key: string]: string }, waitOnExit?: boolean): TPromise<number>;
$createTerminal(name?: string, shellPath?: string, shellArgs?: string[], cwd?: string, env?: { [key: string]: string }, waitOnExit?: boolean): TPromise<number>;
$dispose(terminalId: number): void;
$hide(terminalId: number): void;
$sendText(terminalId: number, text: string, addNewLine: boolean): void;
......
......@@ -23,6 +23,7 @@ export class ExtHostTerminal implements vscode.Terminal {
name?: string,
shellPath?: string,
shellArgs?: string[],
cwd?: string,
env?: { [key: string]: string },
waitOnExit?: boolean
) {
......@@ -32,7 +33,8 @@ export class ExtHostTerminal implements vscode.Terminal {
this._pidPromise = new Promise<number>(c => {
this._pidPromiseComplete = c;
});
this._proxy.$createTerminal(name, shellPath, shellArgs, env, waitOnExit).then((id) => {
this._proxy.$createTerminal(name, shellPath, shellArgs, cwd, env, waitOnExit).then((id) => {
this._id = id;
this._queuedRequests.forEach((r) => {
r.run(this._proxy, this._id);
......@@ -113,7 +115,7 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
}
public createTerminalFromOptions(options: vscode.TerminalOptions): vscode.Terminal {
let terminal = new ExtHostTerminal(this._proxy, options.name, options.shellPath, options.shellArgs, options.env/*, options.waitOnExit*/);
let terminal = new ExtHostTerminal(this._proxy, options.name, options.shellPath, options.shellArgs, options.cwd, options.env /*, options.waitOnExit*/);
this._terminals.push(terminal);
return terminal;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册