mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 02:58:56 +01:00
Implement dispose and hide
This commit is contained in:
@@ -148,8 +148,10 @@ export abstract class MainThreadOutputServiceShape {
|
||||
|
||||
export abstract class MainThreadTerminalServiceShape {
|
||||
$createTerminal(name?: string): TPromise<number> { throw ni(); }
|
||||
$show(terminalId: number, preserveFocus: boolean): void { throw ni(); }
|
||||
$dispose(terminalId: number): void { throw ni(); }
|
||||
$hide(terminalId: number): void { throw ni(); }
|
||||
$sendText(terminalId: number, text: string, addNewLine: boolean): void { throw ni(); }
|
||||
$show(terminalId: number, preserveFocus: boolean): void { throw ni(); }
|
||||
}
|
||||
|
||||
export interface MyQuickPickItems extends IPickOpenEntry {
|
||||
|
||||
@@ -15,6 +15,7 @@ export class ExtHostTerminal implements vscode.Terminal {
|
||||
|
||||
private _id: number;
|
||||
private _proxy: MainThreadTerminalServiceShape;
|
||||
private _disposed: boolean;
|
||||
|
||||
constructor(proxy: MainThreadTerminalServiceShape, id: number, name?: string) {
|
||||
this.name = name;
|
||||
@@ -31,11 +32,14 @@ export class ExtHostTerminal implements vscode.Terminal {
|
||||
}
|
||||
|
||||
public hide(): void {
|
||||
// TODO: Implement
|
||||
this._proxy.$hide(this._id);
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
// TODO: Implement
|
||||
if (!this._disposed) {
|
||||
this._disposed = true;
|
||||
this._proxy.$dispose(this._id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,19 @@ export class MainThreadTerminalService extends MainThreadTerminalServiceShape {
|
||||
});
|
||||
}
|
||||
|
||||
public $hide(terminalId: number): void {
|
||||
this._terminalService.hide();
|
||||
}
|
||||
|
||||
public $dispose(terminalId: number): void {
|
||||
// TODO: This could be improved by not first showing the terminal to be disposed
|
||||
var self = this;
|
||||
this._terminalService.show(false).then((terminalPanel) => {
|
||||
terminalPanel.setActiveTerminalById(terminalId);
|
||||
self._terminalService.close();
|
||||
});;
|
||||
}
|
||||
|
||||
public $sendText(terminalId: number, text: string, addNewLine: boolean): void {
|
||||
this._terminalService.show(false).then((terminalPanel) => {
|
||||
terminalPanel.setActiveTerminalById(terminalId);
|
||||
|
||||
Reference in New Issue
Block a user