Skip to content

Commit

Permalink
Pass pluginInfo through to output channel append method
Browse files Browse the repository at this point in the history
Signed-off-by: Josh Pinkney <joshpinkney@gmail.com>
  • Loading branch information
JPinkney committed Oct 10, 2019
1 parent 54f646c commit ef08840
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/plugin-ext/src/common/plugin-api-rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ export interface PreferenceRegistryExt {
}

export interface OutputChannelRegistryMain {
$append(channelName: string, value: string): PromiseLike<void>;
$append(channelName: string, value: string, pluginInfo: PluginInfo): PromiseLike<void>;
$clear(channelName: string): PromiseLike<void>;
$dispose(channelName: string): PromiseLike<void>;
$reveal(channelName: string, preserveFocus: boolean): PromiseLike<void>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { injectable, inject } from 'inversify';
import { OutputWidget } from '@theia/output/lib/browser/output-widget';
import { OutputContribution } from '@theia/output/lib/browser/output-contribution';
import { OutputChannel, OutputChannelManager } from '@theia/output/lib/common/output-channel';
import { OutputChannelRegistryMain } from '../../common/plugin-api-rpc';
import { OutputChannelRegistryMain, PluginInfo } from '../../common/plugin-api-rpc';

@injectable()
export class OutputChannelRegistryMainImpl implements OutputChannelRegistryMain {
Expand All @@ -33,7 +33,7 @@ export class OutputChannelRegistryMainImpl implements OutputChannelRegistryMain

private channels: Map<string, OutputChannel> = new Map();

$append(channelName: string, value: string): PromiseLike<void> {
$append(channelName: string, value: string, pluginInfo: PluginInfo): PromiseLike<void> {
const outputChannel = this.getChannel(channelName);
if (outputChannel) {
outputChannel.append(value);
Expand Down
6 changes: 3 additions & 3 deletions packages/plugin-ext/src/plugin/output-channel-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/
import {
PLUGIN_RPC_CONTEXT as Ext, OutputChannelRegistryMain
PLUGIN_RPC_CONTEXT as Ext, OutputChannelRegistryMain, PluginInfo
} from '../common/plugin-api-rpc';
import { RPCProtocol } from '../common/rpc-protocol';
import * as theia from '@theia/plugin';
Expand All @@ -28,12 +28,12 @@ export class OutputChannelRegistryExt {
this.proxy = rpc.getProxy(Ext.OUTPUT_CHANNEL_REGISTRY_MAIN);
}

createOutputChannel(name: string): theia.OutputChannel {
createOutputChannel(name: string, pluginInfo: PluginInfo): theia.OutputChannel {
name = name.trim();
if (!name) {
throw new Error('illegal argument \'name\'. must not be falsy');
} else {
return new OutputChannelImpl(name, this.proxy);
return new OutputChannelImpl(name, this.proxy, pluginInfo);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/
import * as theia from '@theia/plugin';
import {OutputChannelRegistryMain} from '../../common/plugin-api-rpc';
import { OutputChannelRegistryMain, PluginInfo } from '../../common/plugin-api-rpc';

export class OutputChannelImpl implements theia.OutputChannel {

private disposed: boolean;

constructor(readonly name: string, private proxy: OutputChannelRegistryMain) {
constructor(readonly name: string, private proxy: OutputChannelRegistryMain, private readonly pluginInfo: PluginInfo) {
}

dispose(): void {
Expand All @@ -33,7 +33,7 @@ export class OutputChannelImpl implements theia.OutputChannel {

append(value: string): void {
this.validate();
this.proxy.$append(this.name, value);
this.proxy.$append(this.name, value, this.pluginInfo);
}

appendLine(value: string): void {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-ext/src/plugin/plugin-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ export function createAPIFactory(
return statusBarMessageRegistryExt.createStatusBarItem(alignment, priority);
},
createOutputChannel(name: string): theia.OutputChannel {
return outputChannelRegistryExt.createOutputChannel(name);
return outputChannelRegistryExt.createOutputChannel(name, pluginToPluginInfo(plugin));
},
createWebviewPanel(viewType: string,
title: string,
Expand Down

0 comments on commit ef08840

Please sign in to comment.