Skip to content

Commit

Permalink
fix: regressions from headless plugins refactoring (#13337)
Browse files Browse the repository at this point in the history
- fix gaps and errors in Inversify DI configuration in the web worker
  for frontend plugins
- restore the onDidDeploy() forwarding lost in the refactoring for
  headless plugins

Fixes #13320

Contributed on behalf of STMicroelectronics

Signed-off-by: Olaf Lessenich <olessenich@eclipsesource.com>
Co-authored-by: Christian W. Damus <cdamus.ext@eclipsesource.com>
  • Loading branch information
xai and cdamus authored Feb 1, 2024
1 parent b15b639 commit 9a51317
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
1 change: 1 addition & 0 deletions packages/plugin-ext/src/hosted/browser/hosted-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ export class HostedPluginSupport extends AbstractHostedPluginSupport<PluginManag
}

protected override afterStart(): void {
this.watcher.onDidDeploy(() => this.load());
this.server.onDidOpenConnection(() => this.load());
}

Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-ext/src/hosted/browser/worker/worker-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import * as theia from '@theia/plugin';
import { emptyPlugin, MAIN_RPC_CONTEXT, Plugin } from '../../../common/plugin-api-rpc';
import { ExtPluginApi } from '../../../common/plugin-ext-api-contribution';
import { getPluginId, PluginMetadata } from '../../../common/plugin-protocol';
import { RPCProtocol, RPCProtocolImpl } from '../../../common/rpc-protocol';
import { RPCProtocol } from '../../../common/rpc-protocol';
import { ClipboardExt } from '../../../plugin/clipboard-ext';
import { EditorsAndDocumentsExtImpl } from '../../../plugin/editors-and-documents';
import { MessageRegistryExt } from '../../../plugin/message-registry';
Expand Down Expand Up @@ -56,7 +56,7 @@ function initialize(contextPath: string, pluginMetadata: PluginMetadata): void {
const container = new Container();
container.load(pluginHostModule);

const rpc: RPCProtocol = container.get(RPCProtocolImpl);
const rpc: RPCProtocol = container.get(RPCProtocol);
const pluginManager = container.get(PluginManagerExtImpl);
pluginManager.setPluginHost({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import { RPCProtocol, RPCProtocolImpl } from '../../../common/rpc-protocol';
import { ClipboardExt } from '../../../plugin/clipboard-ext';
import { EditorsAndDocumentsExtImpl } from '../../../plugin/editors-and-documents';
import { MessageRegistryExt } from '../../../plugin/message-registry';
import { PluginManagerExtImpl } from '../../../plugin/plugin-manager';
import { KeyValueStorageProxy } from '../../../plugin/plugin-storage';
import { MinimalTerminalServiceExt, PluginManagerExtImpl } from '../../../plugin/plugin-manager';
import { InternalStorageExt, KeyValueStorageProxy } from '../../../plugin/plugin-storage';
import { PreferenceRegistryExtImpl } from '../../../plugin/preference-registry';
import { SecretsExtImpl } from '../../../plugin/secrets-ext';
import { InternalSecretsExt, SecretsExtImpl } from '../../../plugin/secrets-ext';
import { TerminalServiceExtImpl } from '../../../plugin/terminal-ext';
import { WebviewsExtImpl } from '../../../plugin/webviews';
import { WorkspaceExtImpl } from '../../../plugin/workspace';
Expand Down Expand Up @@ -58,16 +58,23 @@ export default new ContainerModule(bind => {

bind(PluginManagerExtImpl).toSelf().inSingletonScope();
bind(EnvExtImpl).to(WorkerEnvExtImpl).inSingletonScope();
bind(LocalizationExt).to(LocalizationExtImpl).inSingletonScope();
bind(LocalizationExtImpl).toSelf().inSingletonScope();
bind(LocalizationExt).toService(LocalizationExtImpl);
bind(KeyValueStorageProxy).toSelf().inSingletonScope();
bind(InternalStorageExt).toService(KeyValueStorageProxy);
bind(SecretsExtImpl).toSelf().inSingletonScope();
bind(InternalSecretsExt).toService(SecretsExtImpl);
bind(PreferenceRegistryExtImpl).toSelf().inSingletonScope();
bind(DebugExtImpl).toDynamicValue(({ container }) => createDebugExtStub(container))
.inSingletonScope();
bind(DebugExtImpl).toDynamicValue(({ container }) => {
const child = container.createChild();
child.bind(DebugExtImpl).toSelf();
return createDebugExtStub(child);
}).inSingletonScope();
bind(EditorsAndDocumentsExtImpl).toSelf().inSingletonScope();
bind(WorkspaceExtImpl).toSelf().inSingletonScope();
bind(MessageRegistryExt).toSelf().inSingletonScope();
bind(ClipboardExt).toSelf().inSingletonScope();
bind(WebviewsExtImpl).toSelf().inSingletonScope();
bind(TerminalServiceExtImpl).toSelf().inSingletonScope();
bind(MinimalTerminalServiceExt).toService(TerminalServiceExtImpl);
});
2 changes: 1 addition & 1 deletion packages/plugin-ext/src/plugin/plugin-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class ActivatedPlugin {

export const MinimalTerminalServiceExt = Symbol('MinimalTerminalServiceExt');
export type MinimalTerminalServiceExt = Pick<TerminalServiceExt,
'getEnvironmentVariableCollection'|'$initEnvironmentVariableCollections'|'$setShell'>;
'getEnvironmentVariableCollection' | '$initEnvironmentVariableCollections' | '$setShell'>;

@injectable()
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down

0 comments on commit 9a51317

Please sign in to comment.