提交 d0f63251 编写于 作者: D Daniel Imms

Fix initial terminal API state

上级 e1b6a8c1
......@@ -23,13 +23,19 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostTerminalService);
this._toDispose = [];
this._toDispose.push(terminalService.onInstanceCreated((terminalInstance) => {
// Delay this message so the TerminalInstance constructor has a change to finish and
// Delay this message so the TerminalInstance constructor has a chance to finish and
// return the ID normally to the extension host. The ID that is passed here will be used
// to register non-extension API terminals in the extension host.
setTimeout(() => this._onTerminalOpened(terminalInstance), 100);
}));
this._toDispose.push(terminalService.onInstanceDisposed((terminalInstance) => this._onTerminalDisposed(terminalInstance)));
this._toDispose.push(terminalService.onInstanceProcessIdReady((terminalInstance) => this._onTerminalProcessIdReady(terminalInstance)));
// Set initial ext host state
this.terminalService.terminalInstances.forEach(t => {
this._onTerminalOpened(t);
t.processReady.then(() => this._onTerminalProcessIdReady(t));
});
}
public dispose(): void {
......
......@@ -235,6 +235,8 @@ export interface ITerminalInstance {
onProcessIdReady: Event<ITerminalInstance>;
processReady: TPromise<void>;
/**
* The title of the terminal. This is either title or the process currently running or an
* explicit name given to the terminal instance through the extension API.
......
......@@ -107,7 +107,9 @@ export class TerminalInstance implements ITerminalInstance {
public disableLayout: boolean;
public get id(): number { return this._id; }
// TODO: Ideally processId would be merged into processReady
public get processId(): number { return this._processId; }
public get processReady(): TPromise<void> { return this._processReady; }
public get onDisposed(): Event<ITerminalInstance> { return this._onDisposed.event; }
public get onFocused(): Event<ITerminalInstance> { return this._onFocused.event; }
public get onProcessIdReady(): Event<ITerminalInstance> { return this._onProcessIdReady.event; }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册