@theia/plugin-ext 1.66.0-next.32 → 1.66.0-next.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/lib/common/plugin-identifiers.d.ts +8 -2
  2. package/lib/common/plugin-identifiers.d.ts.map +1 -1
  3. package/lib/common/plugin-identifiers.js +13 -4
  4. package/lib/common/plugin-identifiers.js.map +1 -1
  5. package/lib/common/plugin-protocol.d.ts +7 -6
  6. package/lib/common/plugin-protocol.d.ts.map +1 -1
  7. package/lib/common/plugin-protocol.js.map +1 -1
  8. package/lib/hosted/common/hosted-plugin.d.ts.map +1 -1
  9. package/lib/hosted/common/hosted-plugin.js +9 -3
  10. package/lib/hosted/common/hosted-plugin.js.map +1 -1
  11. package/lib/hosted/node/metadata-scanner.js +1 -1
  12. package/lib/hosted/node/metadata-scanner.js.map +1 -1
  13. package/lib/hosted/node/plugin-deployer-handler-impl.d.ts +2 -2
  14. package/lib/hosted/node/plugin-deployer-handler-impl.d.ts.map +1 -1
  15. package/lib/hosted/node/plugin-deployer-handler-impl.js.map +1 -1
  16. package/lib/hosted/node/plugin-reader.d.ts.map +1 -1
  17. package/lib/hosted/node/plugin-reader.js +2 -1
  18. package/lib/hosted/node/plugin-reader.js.map +1 -1
  19. package/lib/hosted/node/plugin-service.d.ts +4 -3
  20. package/lib/hosted/node/plugin-service.d.ts.map +1 -1
  21. package/lib/hosted/node/plugin-service.js +11 -13
  22. package/lib/hosted/node/plugin-service.js.map +1 -1
  23. package/lib/main/node/plugin-deployer-impl.d.ts +2 -2
  24. package/lib/main/node/plugin-deployer-impl.d.ts.map +1 -1
  25. package/lib/main/node/plugin-deployer-impl.js.map +1 -1
  26. package/lib/main/node/plugin-server-impl.d.ts +3 -3
  27. package/lib/main/node/plugin-server-impl.d.ts.map +1 -1
  28. package/lib/main/node/plugin-server-impl.js.map +1 -1
  29. package/lib/main/node/plugin-uninstallation-manager.d.ts +7 -7
  30. package/lib/main/node/plugin-uninstallation-manager.d.ts.map +1 -1
  31. package/lib/main/node/plugin-uninstallation-manager.js +2 -1
  32. package/lib/main/node/plugin-uninstallation-manager.js.map +1 -1
  33. package/lib/plugin/output-channel/log-output-channel.d.ts.map +1 -1
  34. package/lib/plugin/output-channel/log-output-channel.js +9 -0
  35. package/lib/plugin/output-channel/log-output-channel.js.map +1 -1
  36. package/lib/plugin/output-channel/output-channel-item.d.ts.map +1 -1
  37. package/lib/plugin/output-channel/output-channel-item.js +8 -0
  38. package/lib/plugin/output-channel/output-channel-item.js.map +1 -1
  39. package/package.json +29 -29
  40. package/src/common/plugin-identifiers.ts +11 -3
  41. package/src/common/plugin-protocol.ts +8 -6
  42. package/src/hosted/common/hosted-plugin.ts +11 -3
  43. package/src/hosted/node/metadata-scanner.ts +1 -1
  44. package/src/hosted/node/plugin-deployer-handler-impl.ts +2 -2
  45. package/src/hosted/node/plugin-reader.ts +2 -1
  46. package/src/hosted/node/plugin-service.ts +15 -15
  47. package/src/main/node/plugin-deployer-impl.ts +2 -2
  48. package/src/main/node/plugin-server-impl.ts +3 -3
  49. package/src/main/node/plugin-uninstallation-manager.ts +11 -9
  50. package/src/plugin/output-channel/log-output-channel.ts +10 -0
  51. package/src/plugin/output-channel/output-channel-item.ts +8 -0
@@ -63,7 +63,7 @@ export class HostedPluginServerImpl implements HostedPluginServer {
63
63
  protected toDispose = new DisposableCollection();
64
64
 
65
65
  protected uninstalledPlugins: Set<PluginIdentifiers.VersionedId>;
66
- protected disabledPlugins: Set<PluginIdentifiers.VersionedId>;
66
+ protected disabledPlugins: Set<PluginIdentifiers.UnversionedId>;
67
67
 
68
68
  protected readonly pluginVersions = new Map<PluginIdentifiers.UnversionedId, string>();
69
69
 
@@ -129,6 +129,11 @@ export class HostedPluginServerImpl implements HostedPluginServer {
129
129
  }
130
130
 
131
131
  async getDeployedPluginIds(): Promise<PluginIdentifiers.VersionedId[]> {
132
+ return this.getInstalledPluginIds()
133
+ .then(ids => ids.filter(candidate => this.isInstalledPlugin(candidate) && !this.disabledPlugins.has(PluginIdentifiers.toUnversioned(candidate))));
134
+ }
135
+
136
+ async getInstalledPluginIds(): Promise<PluginIdentifiers.VersionedId[]> {
132
137
  await this.initialized.promise;
133
138
  const backendPlugins = (await this.deployerHandler.getDeployedBackendPlugins())
134
139
  .filter(this.backendPluginHostableFilter);
@@ -136,15 +141,13 @@ export class HostedPluginServerImpl implements HostedPluginServer {
136
141
  this.hostedPlugin.runPluginServer(this.getServerName());
137
142
  }
138
143
  const plugins = new Set<PluginIdentifiers.VersionedId>();
139
- const addIds = async (identifiers: PluginIdentifiers.VersionedId[]): Promise<void> => {
140
- for (const pluginId of identifiers) {
141
- if (this.isRelevantPlugin(pluginId)) {
142
- plugins.add(pluginId);
143
- }
144
- }
145
- };
146
- addIds(await this.deployerHandler.getDeployedFrontendPluginIds());
147
- addIds(await this.deployerHandler.getDeployedBackendPluginIds());
144
+ const addIds = (identifiers: Promise<PluginIdentifiers.VersionedId[]>): Promise<void> => identifiers
145
+ .then(ids => ids.forEach(id => this.isInstalledPlugin(id) && plugins.add(id)));
146
+
147
+ await Promise.all([
148
+ addIds(this.deployerHandler.getDeployedFrontendPluginIds()),
149
+ addIds(this.deployerHandler.getDeployedBackendPluginIds()),
150
+ ]);
148
151
  return Array.from(plugins);
149
152
  }
150
153
 
@@ -155,7 +158,7 @@ export class HostedPluginServerImpl implements HostedPluginServer {
155
158
  * The deployment system may have multiple versions of the same plugin available, but
156
159
  * a single session should only ever activate one of them.
157
160
  */
158
- protected isRelevantPlugin(identifier: PluginIdentifiers.VersionedId): boolean {
161
+ protected isInstalledPlugin(identifier: PluginIdentifiers.VersionedId): boolean {
159
162
  const versionAndId = PluginIdentifiers.idAndVersionFromVersionedId(identifier);
160
163
  if (!versionAndId) {
161
164
  return false;
@@ -168,9 +171,6 @@ export class HostedPluginServerImpl implements HostedPluginServer {
168
171
  return false;
169
172
  }
170
173
 
171
- if (this.disabledPlugins.has(identifier)) {
172
- return false;
173
- }
174
174
  if (knownVersion === undefined) {
175
175
  this.pluginVersions.set(versionAndId.id, versionAndId.version);
176
176
  }
@@ -181,7 +181,7 @@ export class HostedPluginServerImpl implements HostedPluginServer {
181
181
  return Promise.resolve(this.uninstallationManager.getUninstalledPluginIds());
182
182
  }
183
183
 
184
- getDisabledPluginIds(): Promise<readonly PluginIdentifiers.VersionedId[]> {
184
+ getDisabledPluginIds(): Promise<readonly PluginIdentifiers.UnversionedId[]> {
185
185
  return Promise.resolve(this.uninstallationManager.getDisabledPluginIds());
186
186
  }
187
187
 
@@ -141,11 +141,11 @@ export class PluginDeployerImpl implements PluginDeployer {
141
141
  await this.pluginDeployerHandler.uninstallPlugin(pluginId);
142
142
  }
143
143
 
144
- enablePlugin(pluginId: PluginIdentifiers.VersionedId): Promise<boolean> {
144
+ enablePlugin(pluginId: PluginIdentifiers.UnversionedId): Promise<boolean> {
145
145
  return this.pluginDeployerHandler.enablePlugin(pluginId);
146
146
  }
147
147
 
148
- disablePlugin(pluginId: PluginIdentifiers.VersionedId): Promise<boolean> {
148
+ disablePlugin(pluginId: PluginIdentifiers.UnversionedId): Promise<boolean> {
149
149
  return this.pluginDeployerHandler.disablePlugin(pluginId);
150
150
  }
151
151
 
@@ -64,7 +64,7 @@ export class PluginServerImpl implements PluginServer {
64
64
  return Promise.resolve(this.uninstallationManager.getUninstalledPluginIds());
65
65
  }
66
66
 
67
- getDisabledPlugins(): Promise<readonly PluginIdentifiers.VersionedId[]> {
67
+ getDisabledPlugins(): Promise<readonly PluginIdentifiers.UnversionedId[]> {
68
68
  return Promise.resolve(this.uninstallationManager.getDisabledPluginIds());
69
69
  }
70
70
 
@@ -72,11 +72,11 @@ export class PluginServerImpl implements PluginServer {
72
72
  return this.pluginDeployer.uninstall(pluginId);
73
73
  }
74
74
 
75
- enablePlugin(pluginId: PluginIdentifiers.VersionedId): Promise<boolean> {
75
+ enablePlugin(pluginId: PluginIdentifiers.UnversionedId): Promise<boolean> {
76
76
  return this.pluginDeployer.enablePlugin(pluginId);
77
77
  }
78
78
 
79
- disablePlugin(pluginId: PluginIdentifiers.VersionedId): Promise<boolean> {
79
+ disablePlugin(pluginId: PluginIdentifiers.UnversionedId): Promise<boolean> {
80
80
  return this.pluginDeployer.disablePlugin(pluginId);
81
81
  }
82
82
 
@@ -30,11 +30,11 @@ export class PluginUninstallationManager {
30
30
  protected readonly onDidChangeUninstalledPluginsEmitter = new Emitter<readonly PluginIdentifiers.VersionedId[]>();
31
31
  onDidChangeUninstalledPlugins: Event<readonly PluginIdentifiers.VersionedId[]> = this.onDidChangeUninstalledPluginsEmitter.event;
32
32
 
33
- protected readonly onDidChangeDisabledPluginsEmitter = new Emitter<readonly PluginIdentifiers.VersionedId[]>();
34
- onDidChangeDisabledPlugins: Event<readonly PluginIdentifiers.VersionedId[]> = this.onDidChangeDisabledPluginsEmitter.event;
33
+ protected readonly onDidChangeDisabledPluginsEmitter = new Emitter<readonly PluginIdentifiers.UnversionedId[]>();
34
+ onDidChangeDisabledPlugins: Event<readonly PluginIdentifiers.UnversionedId[]> = this.onDidChangeDisabledPluginsEmitter.event;
35
35
 
36
36
  protected uninstalledPlugins: Set<PluginIdentifiers.VersionedId> = new Set();
37
- protected disabledPlugins: Set<PluginIdentifiers.VersionedId> = new Set();
37
+ protected disabledPlugins: Set<PluginIdentifiers.UnversionedId> = new Set();
38
38
 
39
39
  protected readonly initialized = new Deferred<void>();
40
40
 
@@ -45,8 +45,10 @@ export class PluginUninstallationManager {
45
45
 
46
46
  protected async load(): Promise<void> {
47
47
  try {
48
- const disabled: PluginIdentifiers.VersionedId[] = JSON.parse(await this.settingService.get(PluginUninstallationManager.DISABLED_PLUGINS) || '[]');
49
- disabled.forEach(id => this.disabledPlugins.add(id));
48
+ const disabled: (PluginIdentifiers.VersionedId | PluginIdentifiers.UnversionedId)[] =
49
+ JSON.parse(await this.settingService.get(PluginUninstallationManager.DISABLED_PLUGINS) || '[]');
50
+
51
+ disabled.forEach(id => this.disabledPlugins.add(PluginIdentifiers.toUnversioned(id)));
50
52
  } catch (e) {
51
53
  // settings may be corrupt; just carry on
52
54
  console.warn(e);
@@ -91,7 +93,7 @@ export class PluginUninstallationManager {
91
93
  return [...this.uninstalledPlugins];
92
94
  }
93
95
 
94
- async markAsDisabled(...pluginIds: PluginIdentifiers.VersionedId[]): Promise<boolean> {
96
+ async markAsDisabled(...pluginIds: PluginIdentifiers.UnversionedId[]): Promise<boolean> {
95
97
  await this.initialized.promise;
96
98
  let didChange = false;
97
99
  for (const id of pluginIds) {
@@ -107,7 +109,7 @@ export class PluginUninstallationManager {
107
109
  return didChange;
108
110
  }
109
111
 
110
- async markAsEnabled(...pluginIds: PluginIdentifiers.VersionedId[]): Promise<boolean> {
112
+ async markAsEnabled(...pluginIds: PluginIdentifiers.UnversionedId[]): Promise<boolean> {
111
113
  await this.initialized.promise;
112
114
  let didChange = false;
113
115
  for (const id of pluginIds) {
@@ -120,12 +122,12 @@ export class PluginUninstallationManager {
120
122
  return didChange;
121
123
  }
122
124
 
123
- async isDisabled(pluginId: PluginIdentifiers.VersionedId): Promise<boolean> {
125
+ async isDisabled(pluginId: PluginIdentifiers.UnversionedId): Promise<boolean> {
124
126
  await this.initialized.promise;
125
127
  return this.disabledPlugins.has(pluginId);
126
128
  }
127
129
 
128
- async getDisabledPluginIds(): Promise<readonly PluginIdentifiers.VersionedId[]> {
130
+ async getDisabledPluginIds(): Promise<readonly PluginIdentifiers.UnversionedId[]> {
129
131
  await this.initialized.promise;
130
132
  return [...this.disabledPlugins];
131
133
  }
@@ -32,6 +32,16 @@ export class LogOutputChannelImpl extends OutputChannelImpl implements theia.Log
32
32
  constructor(name: string, proxy: OutputChannelRegistryMain, pluginInfo: PluginInfo) {
33
33
  super(name, proxy, pluginInfo);
34
34
  this.setLogLevel(LogLevel.Info);
35
+
36
+ // Bind overridden and new methods to preserve 'this' context
37
+ // These bindings are needed because the parent class bindings don't apply to overridden methods
38
+ this.append = this.append.bind(this);
39
+ this.appendLine = this.appendLine.bind(this);
40
+ this.trace = this.trace.bind(this);
41
+ this.debug = this.debug.bind(this);
42
+ this.info = this.info.bind(this);
43
+ this.warn = this.warn.bind(this);
44
+ this.error = this.error.bind(this);
35
45
  }
36
46
 
37
47
  setLogLevel(level: theia.LogLevel): void {
@@ -21,6 +21,14 @@ export class OutputChannelImpl implements theia.OutputChannel {
21
21
  private disposed: boolean;
22
22
 
23
23
  constructor(readonly name: string, protected readonly proxy: OutputChannelRegistryMain, protected readonly pluginInfo: PluginInfo) {
24
+ // Bind methods to preserve 'this' context when passed as callbacks
25
+ // This ensures compatibility with extensions that pass these methods as function references
26
+ this.append = this.append.bind(this);
27
+ this.appendLine = this.appendLine.bind(this);
28
+ this.replace = this.replace.bind(this);
29
+ this.clear = this.clear.bind(this);
30
+ this.show = this.show.bind(this);
31
+ this.hide = this.hide.bind(this);
24
32
  }
25
33
 
26
34
  dispose(): void {