Split up ext host <-> main thread communication to separate files

This commit is contained in:
Alex Dima
2016-06-27 14:58:03 +02:00
parent fa9d70718c
commit d285fe05e1
43 changed files with 2370 additions and 2196 deletions

View File

@@ -4,13 +4,9 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
import {Registry} from 'vs/platform/platform';
import {IOutputService, IOutputChannel, OUTPUT_PANEL_ID, Extensions, IOutputChannelRegistry} from 'vs/workbench/parts/output/common/output';
import {IPartService} from 'vs/workbench/services/part/common/partService';
import {IPanelService} from 'vs/workbench/services/panel/common/panelService';
import {MainContext} from './extHostProtocol';
import {MainThreadOutputService} from './mainThreadOutputService';
export class ExtHostOutputChannel implements vscode.OutputChannel {
@@ -81,51 +77,3 @@ export class ExtHostOutputService {
}
}
}
export class MainThreadOutputService {
private _outputService: IOutputService;
private _partService: IPartService;
private _panelService: IPanelService;
constructor(@IOutputService outputService: IOutputService,
@IPartService partService: IPartService,
@IPanelService panelService: IPanelService
) {
this._outputService = outputService;
this._partService = partService;
this._panelService = panelService;
}
public append(channelId: string, label: string, value: string): TPromise<void> {
this._getChannel(channelId, label).append(value);
return undefined;
}
public clear(channelId: string, label: string): TPromise<void> {
this._getChannel(channelId, label).clear();
return undefined;
}
public reveal(channelId: string, label: string, preserveFocus: boolean): TPromise<void> {
this._getChannel(channelId, label).show(preserveFocus);
return undefined;
}
private _getChannel(channelId: string, label: string): IOutputChannel {
if (Registry.as<IOutputChannelRegistry>(Extensions.OutputChannels).getChannels().every(channel => channel.id !== channelId)) {
Registry.as<IOutputChannelRegistry>(Extensions.OutputChannels).registerChannel(channelId, label);
}
return this._outputService.getChannel(channelId);
}
public close(channelId: string): TPromise<void> {
const panel = this._panelService.getActivePanel();
if (panel && panel.getId() === OUTPUT_PANEL_ID && channelId === this._outputService.getActiveChannel().id ) {
this._partService.setPanelHidden(true);
}
return undefined;
}
}