提交 a7c2a5a5 编写于 作者: S Sandeep Somavarapu

Fix #79431

上级 cbb93657
...@@ -7,7 +7,7 @@ import { MainContext, MainThreadOutputServiceShape, ExtHostOutputServiceShape } ...@@ -7,7 +7,7 @@ import { MainContext, MainThreadOutputServiceShape, ExtHostOutputServiceShape }
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import { URI } from 'vs/base/common/uri'; import { URI } from 'vs/base/common/uri';
import { Event, Emitter } from 'vs/base/common/event'; import { Event, Emitter } from 'vs/base/common/event';
import { Disposable, MutableDisposable } from 'vs/base/common/lifecycle'; import { Disposable } from 'vs/base/common/lifecycle';
import { VSBuffer } from 'vs/base/common/buffer'; import { VSBuffer } from 'vs/base/common/buffer';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
...@@ -140,20 +140,12 @@ export class ExtHostOutputService implements ExtHostOutputServiceShape { ...@@ -140,20 +140,12 @@ export class ExtHostOutputService implements ExtHostOutputServiceShape {
readonly _serviceBrand: any; readonly _serviceBrand: any;
protected readonly _proxy: MainThreadOutputServiceShape; protected readonly _proxy: MainThreadOutputServiceShape;
protected readonly _channels: Map<string, AbstractExtHostOutputChannel> = new Map<string, AbstractExtHostOutputChannel>();
protected readonly _visibleChannelDisposable = new MutableDisposable();
constructor(@IExtHostRpcService extHostRpc: IExtHostRpcService) { constructor(@IExtHostRpcService extHostRpc: IExtHostRpcService) {
this._proxy = extHostRpc.getProxy(MainContext.MainThreadOutputService); this._proxy = extHostRpc.getProxy(MainContext.MainThreadOutputService);
} }
$setVisibleChannel(channelId: string): void { $setVisibleChannel(channelId: string): void {
if (channelId) {
const channel = this._channels.get(channelId);
if (channel) {
this._visibleChannelDisposable.value = channel.onDidAppend(() => channel.update());
}
}
} }
createOutputChannel(name: string): vscode.OutputChannel { createOutputChannel(name: string): vscode.OutputChannel {
......
...@@ -13,6 +13,7 @@ import { dirExists, mkdirp } from 'vs/base/node/pfs'; ...@@ -13,6 +13,7 @@ import { dirExists, mkdirp } from 'vs/base/node/pfs';
import { AbstractExtHostOutputChannel, ExtHostPushOutputChannel, ExtHostOutputService, LazyOutputChannel } from 'vs/workbench/api/common/extHostOutput'; import { AbstractExtHostOutputChannel, ExtHostPushOutputChannel, ExtHostOutputService, LazyOutputChannel } from 'vs/workbench/api/common/extHostOutput';
import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService'; import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService';
import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
import { MutableDisposable } from 'vs/base/common/lifecycle';
export class ExtHostOutputChannelBackedByFile extends AbstractExtHostOutputChannel { export class ExtHostOutputChannelBackedByFile extends AbstractExtHostOutputChannel {
...@@ -49,6 +50,8 @@ export class ExtHostOutputService2 extends ExtHostOutputService { ...@@ -49,6 +50,8 @@ export class ExtHostOutputService2 extends ExtHostOutputService {
private _logsLocation: URI; private _logsLocation: URI;
private _namePool: number = 1; private _namePool: number = 1;
private readonly _channels: Map<string, AbstractExtHostOutputChannel> = new Map<string, AbstractExtHostOutputChannel>();
private readonly _visibleChannelDisposable = new MutableDisposable();
constructor( constructor(
@IExtHostRpcService extHostRpc: IExtHostRpcService, @IExtHostRpcService extHostRpc: IExtHostRpcService,
...@@ -58,12 +61,23 @@ export class ExtHostOutputService2 extends ExtHostOutputService { ...@@ -58,12 +61,23 @@ export class ExtHostOutputService2 extends ExtHostOutputService {
this._logsLocation = initData.logsLocation; this._logsLocation = initData.logsLocation;
} }
$setVisibleChannel(channelId: string): void {
if (channelId) {
const channel = this._channels.get(channelId);
if (channel) {
this._visibleChannelDisposable.value = channel.onDidAppend(() => channel.update());
}
}
}
createOutputChannel(name: string): vscode.OutputChannel { createOutputChannel(name: string): vscode.OutputChannel {
name = name.trim(); name = name.trim();
if (!name) { if (!name) {
throw new Error('illegal argument `name`. must not be falsy'); throw new Error('illegal argument `name`. must not be falsy');
} }
return new LazyOutputChannel(name, this._doCreateOutChannel(name)); const extHostOutputChannel = this._doCreateOutChannel(name);
extHostOutputChannel.then(channel => channel._id.then(id => this._channels.set(id, channel)));
return new LazyOutputChannel(name, extHostOutputChannel);
} }
private async _doCreateOutChannel(name: string): Promise<AbstractExtHostOutputChannel> { private async _doCreateOutChannel(name: string): Promise<AbstractExtHostOutputChannel> {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册