Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass pluginInfo through to output channel append method #6312

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -991,7 +991,7 @@ export interface PreferenceRegistryExt {
}

export interface OutputChannelRegistryMain {
$append(channelName: string, value: string): PromiseLike<void>;
$append(channelName: string, value: string, pluginInfo: PluginInfo): PromiseLike<void>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, I have two comments:

  1. should we make pluginInfo optional?
  2. should it simply be in the form of options? any so we can potentially pass more in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically we could make it optional, but I was just following what I did in: f25652a

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay fair enough :)

$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