diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index 03d1c020c35..ec8aa7ffa99 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -3084,11 +3084,9 @@ declare namespace vscode { /** * Create a new [output channel](#OutputChannel) with the given name. * - * @param name used as an identifier of the channel. - * @param label Human-readable string which will be used to represent the channel in the UI. - * If not specified name will be used for representing the channel in the UI. + * @param name Human-readable string which will be used to represent the channel in the UI. */ - export function createOutputChannel(name: string, label?: string): OutputChannel; + export function createOutputChannel(name: string): OutputChannel; /** * Set a message to the status bar. This is a short hand for the more powerful diff --git a/src/vs/workbench/api/node/extHost.api.impl.ts b/src/vs/workbench/api/node/extHost.api.impl.ts index c2a236281e4..5f8dda98c30 100644 --- a/src/vs/workbench/api/node/extHost.api.impl.ts +++ b/src/vs/workbench/api/node/extHost.api.impl.ts @@ -234,8 +234,8 @@ export class ExtHostAPIImplementation { setStatusBarMessage(text: string, timeoutOrThenable?: number | Thenable): vscode.Disposable { return extHostStatusBar.setStatusBarMessage(text, timeoutOrThenable); }, - createOutputChannel(name: string, label?: string): vscode.OutputChannel { - return extHostOutputService.createOutputChannel(name, label); + createOutputChannel(name: string): vscode.OutputChannel { + return extHostOutputService.createOutputChannel(name); } }; diff --git a/src/vs/workbench/api/node/extHostOutputService.ts b/src/vs/workbench/api/node/extHostOutputService.ts index e30f2d1e047..dc2fc973e08 100644 --- a/src/vs/workbench/api/node/extHostOutputService.ts +++ b/src/vs/workbench/api/node/extHostOutputService.ts @@ -5,6 +5,7 @@ 'use strict'; import {TPromise} from 'vs/base/common/winjs.base'; +import uuid = require('vs/base/common/uuid'); import {Remotable, IThreadService} from 'vs/platform/thread/common/thread'; import {Registry} from 'vs/platform/platform'; import {IOutputService, IOutputChannel, OUTPUT_PANEL_ID, Extensions, IOutputChannelRegistry} from 'vs/workbench/parts/output/common/output'; @@ -15,12 +16,12 @@ export class ExtHostOutputChannel implements vscode.OutputChannel { private _proxy: MainThreadOutputService; private _name: string; - private _label: string; + private _id: string; private _disposed: boolean; - constructor(name: string, proxy: MainThreadOutputService, label?: string) { + constructor(name: string, proxy: MainThreadOutputService) { this._name = name; - this._label = label; + this._id = uuid.generateUuid(); this._proxy = proxy; } @@ -30,14 +31,14 @@ export class ExtHostOutputChannel implements vscode.OutputChannel { dispose(): void { if (!this._disposed) { - this._proxy.clear(this._name).then(() => { + this._proxy.clear(this._id, this._name).then(() => { this._disposed = true; }); } } append(value: string): void { - this._proxy.append(this._name, this._label, value); + this._proxy.append(this._id, this._name, value); } appendLine(value: string): void { @@ -45,7 +46,7 @@ export class ExtHostOutputChannel implements vscode.OutputChannel { } clear(): void { - this._proxy.clear(this._name); + this._proxy.clear(this._id, this._name); } show(columnOrPreserveFocus?: vscode.ViewColumn | boolean, preserveFocus?: boolean): void { @@ -53,11 +54,11 @@ export class ExtHostOutputChannel implements vscode.OutputChannel { preserveFocus = columnOrPreserveFocus; } - this._proxy.reveal(this._name, preserveFocus); + this._proxy.reveal(this._id, this._name, preserveFocus); } hide(): void { - this._proxy.close(this._name); + this._proxy.close(this._id); } } @@ -69,12 +70,12 @@ export class ExtHostOutputService { this._proxy = threadService.getRemotable(MainThreadOutputService); } - createOutputChannel(name: string, label?: string): vscode.OutputChannel { + createOutputChannel(name: string): vscode.OutputChannel { name = name.trim(); if (!name) { throw new Error('illegal argument `name`. must not be falsy'); } else { - return new ExtHostOutputChannel(name, this._proxy, label); + return new ExtHostOutputChannel(name, this._proxy); } } } @@ -100,19 +101,19 @@ export class MainThreadOutputService { return undefined; } - public clear(channelId: string): TPromise { - this._getChannel(channelId).clear(); + public clear(channelId: string, label: string): TPromise { + this._getChannel(channelId, label).clear(); return undefined; } - public reveal(channelId: string, preserveFocus: boolean): TPromise { - this._getChannel(channelId).show(preserveFocus); + public reveal(channelId: string, label: string, preserveFocus: boolean): TPromise { + this._getChannel(channelId, label).show(preserveFocus); return undefined; } - private _getChannel(channelId: string, label?: string): IOutputChannel { - if (!Registry.as(Extensions.OutputChannels).getChannels().some(channel => channel.id === channelId)) { - Registry.as(Extensions.OutputChannels).registerChannel(channelId, label || channelId); + private _getChannel(channelId: string, label: string): IOutputChannel { + if (Registry.as(Extensions.OutputChannels).getChannels().every(channel => channel.id !== channelId)) { + Registry.as(Extensions.OutputChannels).registerChannel(channelId, label); } return this._outputService.getChannel(channelId);