mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 19:18:59 +01:00
Pass terminal ID through when creating terminal instance
This commit is contained in:
@@ -256,7 +256,7 @@ export class ExtHostAPIImplementation {
|
||||
createOutputChannel(name: string): vscode.OutputChannel {
|
||||
return extHostOutputService.createOutputChannel(name);
|
||||
},
|
||||
createTerminal(name?: string): vscode.Terminal {
|
||||
createTerminal(name?: string): Thenable<vscode.Terminal> {
|
||||
return extHostTerminalService.createTerminal(name);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -147,7 +147,7 @@ export abstract class MainThreadOutputServiceShape {
|
||||
}
|
||||
|
||||
export abstract class MainThreadTerminalServiceShape {
|
||||
$createTerminal(name?: string): void { throw ni(); }
|
||||
$createTerminal(name?: string): TPromise<number> { throw ni(); }
|
||||
$show(terminalId: number, preserveFocus: boolean): void { throw ni(); }
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import {TPromise} from 'vs/base/common/winjs.base';
|
||||
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
|
||||
import vscode = require('vscode');
|
||||
import {MainContext, MainThreadTerminalServiceShape} from './extHost.protocol';
|
||||
@@ -12,10 +13,12 @@ export class ExtHostTerminal implements vscode.Terminal {
|
||||
|
||||
public name: string;
|
||||
|
||||
private _id: number;
|
||||
private _proxy: MainThreadTerminalServiceShape;
|
||||
|
||||
constructor(proxy: MainThreadTerminalServiceShape, name?: string) {
|
||||
constructor(proxy: MainThreadTerminalServiceShape, id: number, name?: string) {
|
||||
this.name = name;
|
||||
this._id = id;
|
||||
this._proxy = proxy;
|
||||
}
|
||||
|
||||
@@ -24,7 +27,7 @@ export class ExtHostTerminal implements vscode.Terminal {
|
||||
}
|
||||
|
||||
public show(preserveFocus: boolean): void {
|
||||
this._proxy.$show(0, preserveFocus);
|
||||
this._proxy.$show(this._id, preserveFocus);
|
||||
}
|
||||
|
||||
public hide(): void {
|
||||
@@ -44,8 +47,9 @@ export class ExtHostTerminalService {
|
||||
this._proxy = threadService.get(MainContext.MainThreadTerminalService);
|
||||
}
|
||||
|
||||
public createTerminal(name?: string): vscode.Terminal {
|
||||
this._proxy.$createTerminal(name);
|
||||
return new ExtHostTerminal(this._proxy, name);
|
||||
public createTerminal(name?: string): TPromise<vscode.Terminal> {
|
||||
return this._proxy.$createTerminal(name).then((terminalId) => {
|
||||
return new ExtHostTerminal(this._proxy, terminalId, name);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import {TPromise} from 'vs/base/common/winjs.base';
|
||||
import {ITerminalService} from 'vs/workbench/parts/terminal/electron-browser/terminal';
|
||||
import {MainThreadTerminalServiceShape} from './extHost.protocol';
|
||||
|
||||
@@ -18,8 +19,9 @@ export class MainThreadTerminalService extends MainThreadTerminalServiceShape {
|
||||
this._terminalService = terminalService;
|
||||
}
|
||||
|
||||
public $createTerminal(name?: string): void {
|
||||
this._terminalService.createNew();
|
||||
public $createTerminal(name?: string): TPromise<number> {
|
||||
// TODO: Use name here
|
||||
return this._terminalService.createNew();
|
||||
}
|
||||
|
||||
public $show(terminalId: number, preserveFocus: boolean): void {
|
||||
|
||||
Reference in New Issue
Block a user