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

feat(plugin): Use product applicationName to return the value to plugins env.appName #7642

Merged
merged 1 commit into from
Apr 23, 2020
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- [task] fixed presentation.reveal & focus for detected tasks [#7548](https://github.com/eclipse-theia/theia/pull/7548)
- [output] added optional argument `severity` to `OutputChannel.appendLine` method for coloring.
- [plugin] env.appName is now reusing the value from `applicationName` defined in package.json under `theia/frontend/config/applicatioName` for example. It allows to customize the value with a single change.

Breaking changes:

Expand Down
1 change: 1 addition & 0 deletions packages/plugin-ext/src/common/plugin-api-rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export interface EnvInit {
queryParams: QueryParameters;
language: string;
shell: string;
appName: string;
}

export interface PluginAPI {
Expand Down
4 changes: 3 additions & 1 deletion packages/plugin-ext/src/hosted/browser/hosted-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import { WidgetManager } from '@theia/core/lib/browser/widget-manager';
import { TerminalService } from '@theia/terminal/lib/browser/base/terminal-service';
import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
import URI from '@theia/core/lib/common/uri';
import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider';

export type PluginHost = 'frontend' | string;
export type DebugActivationEvent = 'onDebugResolve' | 'onDebugInitialConfigurations' | 'onDebugAdapterProtocolTracker';
Expand Down Expand Up @@ -452,7 +453,8 @@ export class HostedPluginSupport {
env: {
queryParams: getQueryParameters(),
language: navigator.language,
shell: defaultShell
shell: defaultShell,
appName: FrontendApplicationConfigProvider.get().applicationName
},
extApi,
webview: {
Expand Down
9 changes: 6 additions & 3 deletions packages/plugin-ext/src/plugin/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@ export abstract class EnvExtImpl {
private proxy: EnvMain;
private queryParameters: QueryParameters;
private lang: string;
private applicationName: string;
private defaultShell: string;
private envMachineId: string;
private envSessionId: string;

public static readonly APP_NAME = 'Eclipse Theia';

constructor(rpc: RPCProtocol) {
this.proxy = rpc.getProxy(PLUGIN_RPC_CONTEXT.ENV_MAIN);
this.envSessionId = v4();
Expand Down Expand Up @@ -57,6 +56,10 @@ export abstract class EnvExtImpl {
this.queryParameters = queryParams;
}

setApplicationName(applicationName: string): void {
this.applicationName = applicationName;
}

setLanguage(lang: string): void {
this.lang = lang;
}
Expand All @@ -70,7 +73,7 @@ export abstract class EnvExtImpl {
}

get appName(): string {
return EnvExtImpl.APP_NAME;
return this.applicationName;
}

abstract get appRoot(): string;
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-ext/src/plugin/plugin-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ export class PluginManagerExtImpl implements PluginManagerExt, PluginManager {
this.envExt.setQueryParameters(params.env.queryParams);
this.envExt.setLanguage(params.env.language);
this.envExt.setShell(params.env.shell);
this.envExt.setApplicationName(params.env.appName);

this.preferencesManager.init(params.preferences);

Expand Down