@theia/plugin-ext 1.75.0-next.29 → 1.75.0-next.34

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 (116) hide show
  1. package/lib/common/plugin-protocol.d.ts +8 -0
  2. package/lib/common/plugin-protocol.d.ts.map +1 -1
  3. package/lib/common/plugin-protocol.js.map +1 -1
  4. package/lib/hosted/browser/hosted-plugin.d.ts +2 -1
  5. package/lib/hosted/browser/hosted-plugin.d.ts.map +1 -1
  6. package/lib/hosted/browser/hosted-plugin.js +8 -3
  7. package/lib/hosted/browser/hosted-plugin.js.map +1 -1
  8. package/lib/hosted/common/hosted-plugin.js +10 -9
  9. package/lib/hosted/common/hosted-plugin.js.map +1 -1
  10. package/lib/hosted/common/hosted-plugin.spec.js +2 -0
  11. package/lib/hosted/common/hosted-plugin.spec.js.map +1 -1
  12. package/lib/hosted/node/hosted-plugin-process.js +1 -0
  13. package/lib/hosted/node/hosted-plugin-process.js.map +1 -1
  14. package/lib/hosted/node/hosted-plugin.js +1 -0
  15. package/lib/hosted/node/hosted-plugin.js.map +1 -1
  16. package/lib/hosted/node/plugin-reader.js +2 -1
  17. package/lib/hosted/node/plugin-reader.js.map +1 -1
  18. package/lib/hosted/node/plugin-service.js +1 -0
  19. package/lib/hosted/node/plugin-service.js.map +1 -1
  20. package/lib/main/browser/comments/comments-service.d.ts +2 -0
  21. package/lib/main/browser/comments/comments-service.d.ts.map +1 -1
  22. package/lib/main/browser/comments/comments-service.js +7 -1
  23. package/lib/main/browser/comments/comments-service.js.map +1 -1
  24. package/lib/main/browser/custom-editors/plugin-custom-editor-registry.d.ts +2 -1
  25. package/lib/main/browser/custom-editors/plugin-custom-editor-registry.d.ts.map +1 -1
  26. package/lib/main/browser/custom-editors/plugin-custom-editor-registry.js +6 -1
  27. package/lib/main/browser/custom-editors/plugin-custom-editor-registry.js.map +1 -1
  28. package/lib/main/browser/debug/plugin-debug-session-contribution-registry.d.ts +2 -0
  29. package/lib/main/browser/debug/plugin-debug-session-contribution-registry.d.ts.map +1 -1
  30. package/lib/main/browser/debug/plugin-debug-session-contribution-registry.js +7 -1
  31. package/lib/main/browser/debug/plugin-debug-session-contribution-registry.js.map +1 -1
  32. package/lib/main/browser/menus/menus-contribution-handler.d.ts +2 -1
  33. package/lib/main/browser/menus/menus-contribution-handler.d.ts.map +1 -1
  34. package/lib/main/browser/menus/menus-contribution-handler.js +9 -4
  35. package/lib/main/browser/menus/menus-contribution-handler.js.map +1 -1
  36. package/lib/main/browser/text-editor-model-service.d.ts +2 -1
  37. package/lib/main/browser/text-editor-model-service.d.ts.map +1 -1
  38. package/lib/main/browser/text-editor-model-service.js +6 -1
  39. package/lib/main/browser/text-editor-model-service.js.map +1 -1
  40. package/lib/main/browser/view/plugin-view-registry.d.ts +2 -0
  41. package/lib/main/browser/view/plugin-view-registry.d.ts.map +1 -1
  42. package/lib/main/browser/view/plugin-view-registry.js +14 -9
  43. package/lib/main/browser/view/plugin-view-registry.js.map +1 -1
  44. package/lib/main/browser/view/tree-view-widget.d.ts +3 -0
  45. package/lib/main/browser/view/tree-view-widget.d.ts.map +1 -1
  46. package/lib/main/browser/view/tree-view-widget.js +17 -6
  47. package/lib/main/browser/view/tree-view-widget.js.map +1 -1
  48. package/lib/main/browser/webview/webview.d.ts.map +1 -1
  49. package/lib/main/browser/webview/webview.js +4 -2
  50. package/lib/main/browser/webview/webview.js.map +1 -1
  51. package/lib/main/browser/webview-views/webview-views-main.d.ts.map +1 -1
  52. package/lib/main/browser/webview-views/webview-views-main.js +3 -2
  53. package/lib/main/browser/webview-views/webview-views-main.js.map +1 -1
  54. package/lib/main/node/handlers/plugin-theia-directory-handler.d.ts +2 -1
  55. package/lib/main/node/handlers/plugin-theia-directory-handler.d.ts.map +1 -1
  56. package/lib/main/node/handlers/plugin-theia-directory-handler.js +10 -4
  57. package/lib/main/node/handlers/plugin-theia-directory-handler.js.map +1 -1
  58. package/lib/main/node/handlers/plugin-theia-file-handler.d.ts +2 -0
  59. package/lib/main/node/handlers/plugin-theia-file-handler.d.ts.map +1 -1
  60. package/lib/main/node/handlers/plugin-theia-file-handler.js +9 -3
  61. package/lib/main/node/handlers/plugin-theia-file-handler.js.map +1 -1
  62. package/lib/main/node/paths/plugin-paths-service.js +1 -0
  63. package/lib/main/node/paths/plugin-paths-service.js.map +1 -1
  64. package/lib/main/node/plugin-deployer-contribution.js +1 -0
  65. package/lib/main/node/plugin-deployer-contribution.js.map +1 -1
  66. package/lib/main/node/plugin-deployer-impl.d.ts.map +1 -1
  67. package/lib/main/node/plugin-deployer-impl.js +16 -13
  68. package/lib/main/node/plugin-deployer-impl.js.map +1 -1
  69. package/lib/main/node/plugin-service.d.ts +2 -0
  70. package/lib/main/node/plugin-service.d.ts.map +1 -1
  71. package/lib/main/node/plugin-service.js +7 -1
  72. package/lib/main/node/plugin-service.js.map +1 -1
  73. package/lib/main/node/plugin-uninstallation-manager.d.ts +2 -1
  74. package/lib/main/node/plugin-uninstallation-manager.d.ts.map +1 -1
  75. package/lib/main/node/plugin-uninstallation-manager.js +6 -1
  76. package/lib/main/node/plugin-uninstallation-manager.js.map +1 -1
  77. package/lib/main/node/plugins-key-value-storage.d.ts +2 -0
  78. package/lib/main/node/plugins-key-value-storage.d.ts.map +1 -1
  79. package/lib/main/node/plugins-key-value-storage.js +9 -3
  80. package/lib/main/node/plugins-key-value-storage.js.map +1 -1
  81. package/lib/main/node/resolvers/local-plugin-deployer-resolver.d.ts +2 -0
  82. package/lib/main/node/resolvers/local-plugin-deployer-resolver.d.ts.map +1 -1
  83. package/lib/main/node/resolvers/local-plugin-deployer-resolver.js +7 -1
  84. package/lib/main/node/resolvers/local-plugin-deployer-resolver.js.map +1 -1
  85. package/lib/main/node/webview-backend-security-warnings.d.ts +2 -0
  86. package/lib/main/node/webview-backend-security-warnings.d.ts.map +1 -1
  87. package/lib/main/node/webview-backend-security-warnings.js +7 -1
  88. package/lib/main/node/webview-backend-security-warnings.js.map +1 -1
  89. package/package.json +31 -31
  90. package/src/common/plugin-protocol.ts +8 -0
  91. package/src/hosted/browser/hosted-plugin.ts +8 -5
  92. package/src/hosted/common/hosted-plugin.spec.ts +2 -0
  93. package/src/hosted/common/hosted-plugin.ts +10 -10
  94. package/src/hosted/node/hosted-plugin-process.ts +1 -1
  95. package/src/hosted/node/hosted-plugin.ts +2 -2
  96. package/src/hosted/node/plugin-reader.ts +3 -3
  97. package/src/hosted/node/plugin-service.ts +1 -1
  98. package/src/main/browser/comments/comments-service.ts +6 -2
  99. package/src/main/browser/custom-editors/plugin-custom-editor-registry.ts +6 -3
  100. package/src/main/browser/debug/plugin-debug-session-contribution-registry.ts +5 -1
  101. package/src/main/browser/menus/menus-contribution-handler.ts +9 -6
  102. package/src/main/browser/text-editor-model-service.ts +6 -3
  103. package/src/main/browser/view/plugin-view-registry.ts +14 -11
  104. package/src/main/browser/view/tree-view-widget.tsx +14 -7
  105. package/src/main/browser/webview/webview.ts +4 -2
  106. package/src/main/browser/webview-views/webview-views-main.ts +4 -4
  107. package/src/main/node/handlers/plugin-theia-directory-handler.ts +9 -6
  108. package/src/main/node/handlers/plugin-theia-file-handler.ts +8 -5
  109. package/src/main/node/paths/plugin-paths-service.ts +2 -2
  110. package/src/main/node/plugin-deployer-contribution.ts +2 -2
  111. package/src/main/node/plugin-deployer-impl.ts +20 -14
  112. package/src/main/node/plugin-service.ts +6 -2
  113. package/src/main/node/plugin-uninstallation-manager.ts +7 -4
  114. package/src/main/node/plugins-key-value-storage.ts +8 -4
  115. package/src/main/node/resolvers/local-plugin-deployer-resolver.ts +7 -2
  116. package/src/main/node/webview-backend-security-warnings.ts +6 -2
@@ -16,8 +16,8 @@
16
16
 
17
17
  /* eslint-disable @typescript-eslint/no-explicit-any */
18
18
 
19
- import { inject, injectable, optional } from '@theia/core/shared/inversify';
20
- import { MenuPath, CommandRegistry, Disposable, DisposableCollection, nls, CommandMenu, AcceleratorSource, ContextExpressionMatcher, environment } from '@theia/core';
19
+ import { inject, injectable, optional, named } from '@theia/core/shared/inversify';
20
+ import { MenuPath, CommandRegistry, Disposable, DisposableCollection, nls, CommandMenu, AcceleratorSource, ContextExpressionMatcher, environment, ILogger } from '@theia/core';
21
21
  import { MenuModelRegistry } from '@theia/core/lib/common';
22
22
  import { TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
23
23
  import { DeployedPlugin, IconUrl, Menu } from '../../../common';
@@ -48,6 +48,9 @@ export class MenusContributionPointHandler {
48
48
  @inject(QuickCommandService) @optional()
49
49
  private readonly quickCommandService: QuickCommandService;
50
50
 
51
+ @inject(ILogger) @named('plugin-ext:MenusContributionPointHandler')
52
+ protected readonly logger: ILogger;
53
+
51
54
  private initialized = false;
52
55
  private initialize(): void {
53
56
  this.initialized = true;
@@ -100,7 +103,7 @@ export class MenusContributionPointHandler {
100
103
  const { group, order } = this.parseGroup(item.group);
101
104
  const { submenu, command } = item;
102
105
  if (submenu && command) {
103
- console.warn(
106
+ this.logger.warn(
104
107
  `Menu item ${command} from plugin ${plugin.metadata.model.id} contributed both submenu and command. Only command will be registered.`
105
108
  );
106
109
  }
@@ -111,7 +114,7 @@ export class MenusContributionPointHandler {
111
114
 
112
115
  const cmd = this.commandRegistry.getCommand(command);
113
116
  if (!cmd) {
114
- console.debug(`No label for action menu node: No command "${command}" exists.`);
117
+ this.logger.debug(`No label for action menu node: No command "${command}" exists.`);
115
118
  return;
116
119
  }
117
120
  const label = cmd.label || cmd.id;
@@ -159,8 +162,8 @@ export class MenusContributionPointHandler {
159
162
  }
160
163
  }
161
164
  } catch (error) {
162
- console.warn(`Failed to register a menu item for plugin ${plugin.metadata.model.id} contributed to ${contributionPoint}`, item);
163
- console.debug(error);
165
+ this.logger.warn(`Failed to register a menu item for plugin ${plugin.metadata.model.id} contributed to ${contributionPoint}`, item);
166
+ this.logger.debug(error);
164
167
  }
165
168
  }
166
169
  }
@@ -13,9 +13,9 @@
13
13
  //
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
- import { Event, Emitter, ListenerList, Listener } from '@theia/core';
16
+ import { Event, Emitter, ListenerList, Listener, ILogger } from '@theia/core';
17
17
  import { MonacoEditorModel, WillSaveMonacoModelEvent } from '@theia/monaco/lib/browser/monaco-editor-model';
18
- import { injectable, inject } from '@theia/core/shared/inversify';
18
+ import { injectable, inject, named } from '@theia/core/shared/inversify';
19
19
  import { MonacoTextModelService } from '@theia/monaco/lib/browser/monaco-text-model-service';
20
20
  import { MonacoWorkspace } from '@theia/monaco/lib/browser/monaco-workspace';
21
21
  import { Schemes } from '../../common/uri-components';
@@ -40,6 +40,9 @@ export class EditorModelService {
40
40
  readonly onModelModeChanged = this.modelModeChangedEmitter.event;
41
41
  readonly onModelRemoved = this.onModelRemovedEmitter.event;
42
42
 
43
+ @inject(ILogger) @named('plugin-ext:EditorModelService')
44
+ protected readonly logger: ILogger;
45
+
43
46
  constructor(@inject(MonacoTextModelService) monacoModelService: MonacoTextModelService,
44
47
  @inject(MonacoWorkspace) monacoWorkspace: MonacoWorkspace) {
45
48
 
@@ -102,7 +105,7 @@ export class EditorModelService {
102
105
  await model.save();
103
106
  return true;
104
107
  } catch (e) {
105
- console.error('Failed to save ', uri.toString(), e);
108
+ this.logger.error('Failed to save ', uri.toString(), e);
106
109
  return false;
107
110
  }
108
111
  })());
@@ -14,7 +14,7 @@
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
16
 
17
- import { injectable, inject, postConstruct, optional } from '@theia/core/shared/inversify';
17
+ import { injectable, inject, postConstruct, optional, named } from '@theia/core/shared/inversify';
18
18
  import {
19
19
  ApplicationShell, ViewContainer as ViewContainerWidget, WidgetManager, QuickViewService,
20
20
  ViewContainerIdentifier, ViewContainerTitleOptions, Widget, FrontendApplicationContribution,
@@ -47,7 +47,7 @@ import { WebviewView, WebviewViewResolver } from '../webview-views/webview-views
47
47
  import { WebviewWidget, WebviewWidgetIdentifier } from '../webview/webview';
48
48
  import { CancellationToken } from '@theia/core/lib/common/cancellation';
49
49
  import { generateUuid } from '@theia/core/lib/common/uuid';
50
- import { nls } from '@theia/core';
50
+ import { nls, ILogger } from '@theia/core';
51
51
  import { TheiaDockPanel } from '@theia/core/lib/browser/shell/theia-dock-panel';
52
52
  import { Deferred } from '@theia/core/lib/common/promise-util';
53
53
  import { ThemeIcon } from '@theia/monaco-editor-core/esm/vs/base/common/themables';
@@ -102,6 +102,9 @@ export class PluginViewRegistry implements FrontendApplicationContribution {
102
102
  @inject(ViewContextKeyService)
103
103
  protected readonly viewContextKeys: ViewContextKeyService;
104
104
 
105
+ @inject(ILogger) @named('plugin-ext:PluginViewRegistry')
106
+ protected readonly logger: ILogger;
107
+
105
108
  protected readonly onDidExpandViewEmitter = new Emitter<string>();
106
109
  readonly onDidExpandView = this.onDidExpandViewEmitter.event;
107
110
 
@@ -312,7 +315,7 @@ export class PluginViewRegistry implements FrontendApplicationContribution {
312
315
  registerViewContainer(location: string, viewContainer: ViewContainer): Disposable {
313
316
  const containerId = `workbench.view.extension.${viewContainer.id}`;
314
317
  if (this.viewContainers.has(containerId)) {
315
- console.warn('view container such id already registered: ', JSON.stringify(viewContainer));
318
+ this.logger.warn('view container such id already registered: ', JSON.stringify(viewContainer));
316
319
  return Disposable.NULL;
317
320
  }
318
321
  const toDispose = new DisposableCollection();
@@ -521,7 +524,7 @@ export class PluginViewRegistry implements FrontendApplicationContribution {
521
524
  viewContainerId = `workbench.view.extension.${viewContainerId}`;
522
525
  }
523
526
  if (this.views.has(view.id)) {
524
- console.warn('view with such id already registered: ', JSON.stringify(view));
527
+ this.logger.warn('view with such id already registered: ', JSON.stringify(view));
525
528
  return Disposable.NULL;
526
529
  }
527
530
  const toDispose = new DisposableCollection();
@@ -922,39 +925,39 @@ export class PluginViewRegistry implements FrontendApplicationContribution {
922
925
  for (const id of this.viewContainers.keys()) {
923
926
  promises.push((async () => {
924
927
  await this.initViewContainer(id);
925
- })().catch(console.error));
928
+ })().catch(e => this.logger.error(e)));
926
929
  }
927
930
  promises.push((async () => {
928
931
  const explorer = await this.widgetManager.getWidget(EXPLORER_VIEW_CONTAINER_ID);
929
932
  if (explorer instanceof ViewContainerWidget) {
930
933
  await this.prepareViewContainer('explorer', explorer);
931
934
  }
932
- })().catch(console.error));
935
+ })().catch(e => this.logger.error(e)));
933
936
  promises.push((async () => {
934
937
  const scm = await this.widgetManager.getWidget(SCM_VIEW_CONTAINER_ID);
935
938
  if (scm instanceof ViewContainerWidget) {
936
939
  await this.prepareViewContainer('scm', scm);
937
940
  }
938
- })().catch(console.error));
941
+ })().catch(e => this.logger.error(e)));
939
942
  promises.push((async () => {
940
943
  const search = await this.widgetManager.getWidget(SEARCH_VIEW_CONTAINER_ID);
941
944
  if (search instanceof ViewContainerWidget) {
942
945
  await this.prepareViewContainer('search', search);
943
946
  }
944
- })().catch(console.error));
947
+ })().catch(e => this.logger.error(e)));
945
948
  promises.push((async () => {
946
949
  const test = await this.widgetManager.getWidget(TEST_VIEW_CONTAINER_ID);
947
950
  if (test instanceof ViewContainerWidget) {
948
951
  await this.prepareViewContainer('test', test);
949
952
  }
950
- })().catch(console.error));
953
+ })().catch(e => this.logger.error(e)));
951
954
  promises.push((async () => {
952
955
  const debug = await this.widgetManager.getWidget(DebugWidget.ID);
953
956
  if (debug instanceof DebugWidget) {
954
957
  const viewContainer = debug['sessionWidget']['viewContainer'];
955
958
  await this.prepareViewContainer('debug', viewContainer);
956
959
  }
957
- })().catch(console.error));
960
+ })().catch(e => this.logger.error(e)));
958
961
  await Promise.all(promises);
959
962
  }
960
963
 
@@ -1016,7 +1019,7 @@ export class PluginViewRegistry implements FrontendApplicationContribution {
1016
1019
 
1017
1020
  registerViewDataProvider(viewId: string, provider: ViewDataProvider): Disposable {
1018
1021
  if (this.viewDataProviders.has(viewId)) {
1019
- console.error(`data provider for '${viewId}' view is already registered`);
1022
+ this.logger.error(`data provider for '${viewId}' view is already registered`);
1020
1023
  return Disposable.NULL;
1021
1024
  }
1022
1025
  this.viewDataProviders.set(viewId, provider);
@@ -14,7 +14,7 @@
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
16
 
17
- import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
17
+ import { injectable, inject, postConstruct, named } from '@theia/core/shared/inversify';
18
18
  import { TreeViewsExt, TreeViewItemCollapsibleState, TreeViewItem, TreeViewItemReference, ThemeIcon, DataTransferFileDTO } from '../../../common/plugin-api-rpc';
19
19
  import { Command } from '../../../common/plugin-api-rpc-model';
20
20
  import {
@@ -53,6 +53,7 @@ import { CancellationTokenSource, CancellationToken, Mutable } from '@theia/core
53
53
  import { mixin } from '../../../common/types';
54
54
  import { Deferred } from '@theia/core/lib/common/promise-util';
55
55
  import { DnDFileContentStore } from './dnd-file-content-store';
56
+ import { ILogger } from '@theia/core';
56
57
 
57
58
  export const TREE_NODE_HYPERLINK = 'theia-TreeNodeHyperlink';
58
59
  export const VIEW_ITEM_CONTEXT_MENU: MenuPath = ['view-item-context-menu'];
@@ -183,6 +184,9 @@ export class PluginTree extends TreeImpl {
183
184
  @inject(MessageService)
184
185
  protected readonly notification: MessageService;
185
186
 
187
+ @inject(ILogger) @named('plugin-ext:PluginTree')
188
+ protected override readonly logger: ILogger;
189
+
186
190
  protected readonly onDidChangeWelcomeStateEmitter: Emitter<void> = new Emitter<void>();
187
191
  readonly onDidChangeWelcomeState = this.onDidChangeWelcomeStateEmitter.event;
188
192
 
@@ -235,7 +239,7 @@ export class PluginTree extends TreeImpl {
235
239
  return children || [];
236
240
  } catch (e) {
237
241
  if (e) {
238
- console.error(`Failed to fetch children for '${this.options.id}'`, e);
242
+ this.logger.error(`Failed to fetch children for '${this.options.id}'`, e);
239
243
  const label = this._viewInfo ? this._viewInfo.name : this.options.id;
240
244
  this.notification.error(`${label}: ${e.message}`);
241
245
  }
@@ -473,6 +477,9 @@ export class TreeViewWidget extends TreeViewWelcomeWidget {
473
477
  @inject(DnDFileContentStore)
474
478
  protected readonly dndFileContentStore: DnDFileContentStore;
475
479
 
480
+ @inject(ILogger) @named('plugin-ext:TreeViewWidget')
481
+ protected readonly logger: ILogger;
482
+
476
483
  protected treeDragType: string;
477
484
  protected readonly expansionTimeouts: Map<string, number> = new Map();
478
485
 
@@ -633,17 +640,17 @@ export class TreeViewWidget extends TreeViewWelcomeWidget {
633
640
  handleDragLeave(node: TreeViewNode, event: React.DragEvent<HTMLElement>): void {
634
641
  const timeout = this.expansionTimeouts.get(node.id);
635
642
  if (typeof timeout !== 'undefined') {
636
- console.debug(`dragleave ${node.id} canceling timeout`);
643
+ this.logger.debug(`dragleave ${node.id} canceling timeout`);
637
644
  clearTimeout(timeout);
638
645
  this.expansionTimeouts.delete(node.id);
639
646
  }
640
647
  }
641
648
  handleDragEnter(node: TreeViewNode, event: React.DragEvent<HTMLElement>): void {
642
- console.debug(`dragenter ${node.id}`);
649
+ this.logger.debug(`dragenter ${node.id}`);
643
650
  if (ExpandableTreeNode.is(node)) {
644
- console.debug(`dragenter ${node.id} starting timeout`);
651
+ this.logger.debug(`dragenter ${node.id} starting timeout`);
645
652
  this.expansionTimeouts.set(node.id, window.setTimeout(() => {
646
- console.debug(`dragenter ${node.id} timeout reached`);
653
+ this.logger.debug(`dragenter ${node.id} timeout reached`);
647
654
  this.model.expandNode(node);
648
655
  }, 500));
649
656
  }
@@ -870,7 +877,7 @@ export class TreeViewWidget extends TreeViewWelcomeWidget {
870
877
  const allResolved = Promise.all(treeNodes.map(maybeNeedsResolve => {
871
878
  if (!maybeNeedsResolve.command && maybeNeedsResolve instanceof ResolvableTreeViewNode && !maybeNeedsResolve.resolved) {
872
879
  return maybeNeedsResolve.resolve(cancellationToken).catch(err => {
873
- console.error(`Failed to resolve tree item '${maybeNeedsResolve.id}'`, err);
880
+ this.logger.error(`Failed to resolve tree item '${maybeNeedsResolve.id}'`, err);
874
881
  });
875
882
  }
876
883
  return Promise.resolve(maybeNeedsResolve);
@@ -477,10 +477,12 @@ export class WebviewWidget extends BaseWidget implements StatefulWidget, Extract
477
477
 
478
478
  protected forwardConsoleLog(log: WebviewConsoleLog): void {
479
479
  const message = `[webview: ${this.identifier.id}] ${log.message ? JSON.parse(log.message) : undefined}`;
480
+ // `console.log` has no direct `ILogger` counterpart, so it is reported as `info`.
481
+ const level = log.level === 'log' ? 'info' : log.level;
480
482
  if (log.optionalParams !== undefined) {
481
- console[log.level](message, ...JSON.parse(log.optionalParams));
483
+ this.logger[level](message, ...JSON.parse(log.optionalParams));
482
484
  } else {
483
- console[log.level](message);
485
+ this.logger[level](message);
484
486
  }
485
487
  }
486
488
 
@@ -19,7 +19,7 @@
19
19
  *--------------------------------------------------------------------------------------------*/
20
20
  // some code copied and modified from https://github.com/microsoft/vscode/blob/e1f0f8f51390dea5df9096718fb6b647ed5a9534/src/vs/workbench/api/browser/mainThreadWebviewViews.ts
21
21
 
22
- import { inject, interfaces } from '@theia/core/shared/inversify';
22
+ import { inject, interfaces, named } from '@theia/core/shared/inversify';
23
23
  import { WebviewViewsMain, MAIN_RPC_CONTEXT, WebviewViewsExt } from '../../../common/plugin-api-rpc';
24
24
  import { RPCProtocol } from '../../../common/rpc-protocol';
25
25
  import { Disposable, DisposableCollection, ILogger } from '@theia/core';
@@ -44,7 +44,7 @@ export class WebviewViewsMainImpl implements WebviewViewsMain, Disposable {
44
44
  protected readonly pluginViewRegistry: PluginViewRegistry;
45
45
  protected readonly badgeService: BadgeService;
46
46
 
47
- @inject(ILogger)
47
+ @inject(ILogger) @named('plugin-ext:WebviewViewsMainImpl')
48
48
  protected readonly logger: ILogger;
49
49
 
50
50
  constructor(rpc: RPCProtocol,
@@ -77,9 +77,9 @@ export class WebviewViewsMainImpl implements WebviewViewsMain, Disposable {
77
77
  if (webviewView.webview.state) {
78
78
  try {
79
79
  state = JSON.parse(webviewView.webview.state);
80
- console.log(state);
80
+ this.logger.info(state);
81
81
  } catch (e) {
82
- console.error('Could not load webview state', e, webviewView.webview.state);
82
+ this.logger.error('Could not load webview state', e, webviewView.webview.state);
83
83
  }
84
84
  }
85
85
  if (options) {
@@ -17,8 +17,8 @@
17
17
  import * as path from 'path';
18
18
  import * as filenamify from 'filenamify';
19
19
  import * as fs from '@theia/core/shared/fs-extra';
20
- import type { URI } from '@theia/core';
21
- import { inject, injectable } from '@theia/core/shared/inversify';
20
+ import { URI, ILogger } from '@theia/core';
21
+ import { inject, injectable, named } from '@theia/core/shared/inversify';
22
22
  import { Deferred } from '@theia/core/lib/common/promise-util';
23
23
  import { FileUri } from '@theia/core/lib/node';
24
24
  import {
@@ -34,6 +34,9 @@ export abstract class AbstractPluginDirectoryHandler implements PluginDeployerDi
34
34
 
35
35
  @inject(PluginCliContribution) protected readonly pluginCli: PluginCliContribution;
36
36
 
37
+ @inject(ILogger) @named('plugin-ext:AbstractPluginDirectoryHandler')
38
+ protected readonly logger: ILogger;
39
+
37
40
  constructor() {
38
41
  this.deploymentDirectory = new Deferred();
39
42
  getTempDirPathAsync('theia-copied')
@@ -42,7 +45,7 @@ export abstract class AbstractPluginDirectoryHandler implements PluginDeployerDi
42
45
 
43
46
  async accept(resolvedPlugin: PluginDeployerEntry): Promise<boolean> {
44
47
 
45
- console.debug(`Plugin directory handler: accepting plugin with path ${resolvedPlugin.path()}`);
48
+ this.logger.debug(`Plugin directory handler: accepting plugin with path ${resolvedPlugin.path()}`);
46
49
 
47
50
  // handle only directories
48
51
  if (await resolvedPlugin.isFile()) {
@@ -89,9 +92,9 @@ export abstract class AbstractPluginDirectoryHandler implements PluginDeployerDi
89
92
  const targetDir = await this.getExtensionDir(context);
90
93
  try {
91
94
  if (await fs.pathExists(targetDir) || !entry.path().startsWith(origin)) {
92
- console.log(`[${id}]: already copied.`);
95
+ this.logger.info(`[${id}]: already copied.`);
93
96
  } else {
94
- console.log(`[${id}]: copying to "${targetDir}"`);
97
+ this.logger.info(`[${id}]: copying to "${targetDir}"`);
95
98
  const deploymentDirectory = await this.deploymentDirectory.promise;
96
99
  await fs.mkdirp(FileUri.fsPath(deploymentDirectory));
97
100
  await context.copy(origin, targetDir);
@@ -101,7 +104,7 @@ export abstract class AbstractPluginDirectoryHandler implements PluginDeployerDi
101
104
  }
102
105
  }
103
106
  } catch (e) {
104
- console.warn(`[${id}]: Error when copying.`, e);
107
+ this.logger.warn(`[${id}]: Error when copying.`, e);
105
108
  entry.updatePath(pathToRestore);
106
109
  }
107
110
  }
@@ -15,8 +15,8 @@
15
15
  // *****************************************************************************
16
16
 
17
17
  import { PluginDeployerFileHandler, PluginDeployerEntry, PluginDeployerFileHandlerContext, PluginType } from '../../../common/plugin-protocol';
18
- import type { URI } from '@theia/core';
19
- import { inject, injectable } from '@theia/core/shared/inversify';
18
+ import { URI, ILogger } from '@theia/core';
19
+ import { inject, injectable, named } from '@theia/core/shared/inversify';
20
20
  import { Deferred } from '@theia/core/lib/common/promise-util';
21
21
  import { getTempDirPathAsync } from '../temp-dir-util';
22
22
  import * as fs from '@theia/core/shared/fs-extra';
@@ -32,6 +32,9 @@ export class PluginTheiaFileHandler implements PluginDeployerFileHandler {
32
32
  @inject(PluginTheiaEnvironment)
33
33
  protected readonly environment: PluginTheiaEnvironment;
34
34
 
35
+ @inject(ILogger) @named('plugin-ext:PluginTheiaFileHandler')
36
+ protected readonly logger: ILogger;
37
+
35
38
  constructor() {
36
39
  this.systemPluginsDirUri = new Deferred();
37
40
  getTempDirPathAsync('theia-unpacked')
@@ -48,14 +51,14 @@ export class PluginTheiaFileHandler implements PluginDeployerFileHandler {
48
51
  async handle(context: PluginDeployerFileHandlerContext): Promise<void> {
49
52
  const id = context.pluginEntry().id();
50
53
  const pluginDir = await this.getPluginDir(context);
51
- console.log(`[${id}]: trying to decompress into "${pluginDir}"...`);
54
+ this.logger.info(`[${id}]: trying to decompress into "${pluginDir}"...`);
52
55
  if (context.pluginEntry().type === PluginType.User && await fs.pathExists(pluginDir)) {
53
- console.log(`[${id}]: already found`);
56
+ this.logger.info(`[${id}]: already found`);
54
57
  context.pluginEntry().updatePath(pluginDir);
55
58
  return;
56
59
  }
57
60
  await context.unzip(context.pluginEntry().path(), pluginDir);
58
- console.log(`[${id}]: decompressed`);
61
+ this.logger.info(`[${id}]: decompressed`);
59
62
  context.pluginEntry().updatePath(pluginDir);
60
63
  }
61
64
 
@@ -14,7 +14,7 @@
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
16
 
17
- import { injectable, inject } from '@theia/core/shared/inversify';
17
+ import { injectable, inject, named } from '@theia/core/shared/inversify';
18
18
  import URI from '@theia/core/lib/common/uri';
19
19
  import * as path from 'path';
20
20
  import * as fs from '@theia/core/shared/fs-extra';
@@ -35,7 +35,7 @@ const SESSION_TIMESTAMP_PATTERN = /^\d{8}T\d{6}$/;
35
35
  @injectable()
36
36
  export class PluginPathsServiceImpl implements PluginPathsService {
37
37
 
38
- @inject(ILogger)
38
+ @inject(ILogger) @named('plugin-ext:PluginPathsServiceImpl')
39
39
  protected readonly logger: ILogger;
40
40
 
41
41
  @inject(EnvVariablesServer)
@@ -15,14 +15,14 @@
15
15
  // *****************************************************************************
16
16
 
17
17
  import { BackendApplicationContribution } from '@theia/core/lib/node';
18
- import { injectable, inject } from '@theia/core/shared/inversify';
18
+ import { injectable, inject, named } from '@theia/core/shared/inversify';
19
19
  import { PluginDeployer } from '../../common/plugin-protocol';
20
20
  import { ILogger } from '@theia/core';
21
21
 
22
22
  @injectable()
23
23
  export class PluginDeployerContribution implements BackendApplicationContribution {
24
24
 
25
- @inject(ILogger)
25
+ @inject(ILogger) @named('plugin-ext:PluginDeployerContribution')
26
26
  protected readonly logger: ILogger;
27
27
 
28
28
  @inject(PluginDeployer)
@@ -293,30 +293,36 @@ export class PluginDeployerImpl implements PluginDeployer {
293
293
  * deploy all plugins that have been accepted
294
294
  */
295
295
  async deployPlugins(pluginsToDeploy: PluginDeployerEntry[]): Promise<number> {
296
- const acceptedPlugins = pluginsToDeploy.filter(pluginDeployerEntry => pluginDeployerEntry.isAccepted());
296
+ const acceptedPlugins = pluginsToDeploy.filter(pluginDeployerEntry =>
297
+ pluginDeployerEntry.isAccepted(PluginDeployerEntryType.FRONTEND, PluginDeployerEntryType.BACKEND, PluginDeployerEntryType.HEADLESS));
297
298
  const acceptedFrontendPlugins = pluginsToDeploy.filter(pluginDeployerEntry => pluginDeployerEntry.isAccepted(PluginDeployerEntryType.FRONTEND));
298
299
  const acceptedBackendPlugins = pluginsToDeploy.filter(pluginDeployerEntry => pluginDeployerEntry.isAccepted(PluginDeployerEntryType.BACKEND));
299
300
  const acceptedHeadlessPlugins = pluginsToDeploy.filter(pluginDeployerEntry => pluginDeployerEntry.isAccepted(PluginDeployerEntryType.HEADLESS));
300
301
 
301
- this.logger.debug('the accepted plugins are', acceptedPlugins);
302
- this.logger.debug('the acceptedFrontendPlugins plugins are', acceptedFrontendPlugins);
303
- this.logger.debug('the acceptedBackendPlugins plugins are', acceptedBackendPlugins);
304
- this.logger.debug('the acceptedHeadlessPlugins plugins are', acceptedHeadlessPlugins);
305
-
306
- acceptedPlugins.forEach(plugin => {
307
- this.logger.debug('will deploy plugin', plugin.id(), 'with changes', JSON.stringify(plugin.getChanges()), 'and this plugin has been resolved by', plugin.resolvedBy());
302
+ this.logger.debug(log => {
303
+ log('the accepted plugins are', acceptedPlugins);
304
+ log('the acceptedFrontendPlugins plugins are', acceptedFrontendPlugins);
305
+ log('the acceptedBackendPlugins plugins are', acceptedBackendPlugins);
306
+ log('the acceptedHeadlessPlugins plugins are', acceptedHeadlessPlugins);
307
+ acceptedPlugins.forEach(plugin => {
308
+ log(
309
+ 'will deploy plugin', plugin.id(), 'with changes', JSON.stringify(plugin.getChanges()),
310
+ 'and this plugin has been resolved by', plugin.resolvedBy()
311
+ );
312
+ });
308
313
  });
309
314
 
310
315
  // local path to launch
311
316
  const pluginPaths = [...acceptedBackendPlugins, ...acceptedHeadlessPlugins].map(pluginEntry => pluginEntry.path());
312
317
  this.logger.debug('local path to deploy on remote instance', pluginPaths);
313
318
 
314
- const deployments = [];
315
- // start the backend plugins
316
- deployments.push(await this.pluginDeployerHandler.deployBackendPlugins(acceptedBackendPlugins));
317
- // headless plugins are deployed like backend plugins
318
- deployments.push(await this.pluginDeployerHandler.deployBackendPlugins(acceptedHeadlessPlugins));
319
- deployments.push(await this.pluginDeployerHandler.deployFrontendPlugins(acceptedFrontendPlugins));
319
+ const deployPluginsMeasurement = this.measure('deployPluginsBatch');
320
+ const deployments = await Promise.all([
321
+ // start the backend and headless plugins
322
+ this.pluginDeployerHandler.deployBackendPlugins([...acceptedBackendPlugins, ...acceptedHeadlessPlugins]),
323
+ this.pluginDeployerHandler.deployFrontendPlugins(acceptedFrontendPlugins)
324
+ ]);
325
+ deployPluginsMeasurement.log(`Deploy batch of ${acceptedPlugins.length} accepted plugins`);
320
326
  this.onDidDeployEmitter.fire(undefined);
321
327
  return deployments.reduce<number>((accumulated, current) => accumulated += current ?? 0, 0);
322
328
  }
@@ -19,13 +19,14 @@ import * as path from 'path';
19
19
  const vhost = require('vhost');
20
20
  import * as express from '@theia/core/shared/express';
21
21
  import { BackendApplicationContribution } from '@theia/core/lib/node/backend-application';
22
- import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
22
+ import { inject, injectable, postConstruct, named } from '@theia/core/shared/inversify';
23
23
  import { WebviewExternalEndpoint } from '../common/webview-protocol';
24
24
  import { environment } from '@theia/core/shared/@theia/application-package/lib/environment';
25
25
  import { WsRequestValidatorContribution } from '@theia/core/lib/node/ws-request-validators';
26
26
  import { MaybePromise } from '@theia/core/lib/common';
27
27
  import { ApplicationPackage } from '@theia/core/shared/@theia/application-package';
28
28
  import { BackendRemoteService } from '@theia/core/lib/node/remote/backend-remote-service';
29
+ import { ILogger } from '@theia/core';
29
30
 
30
31
  @injectable()
31
32
  export class PluginApiContribution implements BackendApplicationContribution, WsRequestValidatorContribution {
@@ -40,10 +41,13 @@ export class PluginApiContribution implements BackendApplicationContribution, Ws
40
41
  @inject(BackendRemoteService)
41
42
  protected readonly remoteService: BackendRemoteService;
42
43
 
44
+ @inject(ILogger) @named('plugin-ext:PluginApiContribution')
45
+ protected readonly logger: ILogger;
46
+
43
47
  @postConstruct()
44
48
  protected init(): void {
45
49
  const webviewExternalEndpoint = this.webviewExternalEndpoint();
46
- console.log(`Configuring to accept webviews on '${webviewExternalEndpoint}' hostname.`);
50
+ this.logger.info(`Configuring to accept webviews on '${webviewExternalEndpoint}' hostname.`);
47
51
  this.webviewExternalEndpointRegExp = new RegExp(webviewExternalEndpoint, 'i');
48
52
  }
49
53
 
@@ -14,8 +14,8 @@
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
16
 
17
- import { Emitter, Event } from '@theia/core';
18
- import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
17
+ import { Emitter, Event, ILogger } from '@theia/core';
18
+ import { inject, injectable, postConstruct, named } from '@theia/core/shared/inversify';
19
19
  import { PluginIdentifiers } from '../../common';
20
20
  import { SettingService } from '@theia/core/lib/node';
21
21
  import { Deferred } from '@theia/core/lib/common/promise-util';
@@ -27,6 +27,9 @@ export class PluginUninstallationManager {
27
27
  @inject(SettingService)
28
28
  protected readonly settingService: SettingService;
29
29
 
30
+ @inject(ILogger) @named('plugin-ext:PluginUninstallationManager')
31
+ protected readonly logger: ILogger;
32
+
30
33
  protected readonly onDidChangeUninstalledPluginsEmitter = new Emitter<readonly PluginIdentifiers.VersionedId[]>();
31
34
  onDidChangeUninstalledPlugins: Event<readonly PluginIdentifiers.VersionedId[]> = this.onDidChangeUninstalledPluginsEmitter.event;
32
35
 
@@ -46,12 +49,12 @@ export class PluginUninstallationManager {
46
49
  protected async load(): Promise<void> {
47
50
  try {
48
51
  const disabled: (PluginIdentifiers.VersionedId | PluginIdentifiers.UnversionedId)[] =
49
- JSON.parse(await this.settingService.get(PluginUninstallationManager.DISABLED_PLUGINS) || '[]');
52
+ JSON.parse(await this.settingService.get(PluginUninstallationManager.DISABLED_PLUGINS) || '[]');
50
53
 
51
54
  disabled.forEach(id => this.disabledPlugins.add(PluginIdentifiers.toUnversioned(id)));
52
55
  } catch (e) {
53
56
  // settings may be corrupt; just carry on
54
- console.warn(e);
57
+ this.logger.warn(e);
55
58
  }
56
59
  }
57
60
 
@@ -14,7 +14,7 @@
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
16
 
17
- import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
17
+ import { injectable, inject, postConstruct, named } from '@theia/core/shared/inversify';
18
18
  import { FileSystemLocking } from '@theia/core/lib/node';
19
19
  import * as fs from '@theia/core/shared/fs-extra';
20
20
  import * as path from 'path';
@@ -25,6 +25,7 @@ import { PluginPaths } from './paths/const';
25
25
  import { PluginPathsService } from '../common/plugin-paths-protocol';
26
26
  import { KeysToAnyValues, KeysToKeysToAnyValue } from '../../common/types';
27
27
  import { PluginStorageKind } from '../../common';
28
+ import { ILogger } from '@theia/core';
28
29
 
29
30
  export interface Store {
30
31
  fsPath: string
@@ -49,10 +50,13 @@ export class PluginsKeyValueStorage {
49
50
  @inject(FileSystemLocking)
50
51
  private fsLocking: FileSystemLocking;
51
52
 
53
+ @inject(ILogger) @named('plugin-ext:PluginsKeyValueStorage')
54
+ protected readonly logger: ILogger;
55
+
52
56
  @postConstruct()
53
57
  protected init(): void {
54
58
  this.deferredGlobalDataPath.resolve(this.getGlobalDataPath().catch(error => {
55
- console.error('Failed to initialize global state path:', error);
59
+ this.logger.error('Failed to initialize global state path:', error);
56
60
  return undefined;
57
61
  }));
58
62
  process.once('beforeExit', () => this.dispose());
@@ -62,7 +66,7 @@ export class PluginsKeyValueStorage {
62
66
  async set(key: string, value: KeysToAnyValues, kind: PluginStorageKind): Promise<boolean> {
63
67
  const store = await this.getStore(kind);
64
68
  if (!store) {
65
- console.warn('Cannot save data: no opened workspace');
69
+ this.logger.warn('Cannot save data: no opened workspace');
66
70
  return false;
67
71
  }
68
72
  if (value === undefined || Object.keys(value).length === 0) {
@@ -144,7 +148,7 @@ export class PluginsKeyValueStorage {
144
148
  try {
145
149
  return await fs.readJSON(pathToFile);
146
150
  } catch (error) {
147
- console.error('Failed to parse data from "', pathToFile, '". Reason:', error);
151
+ this.logger.error('Failed to parse data from "', pathToFile, '". Reason:', error);
148
152
  return {};
149
153
  }
150
154
  }
@@ -14,15 +14,20 @@
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
16
 
17
- import { injectable } from '@theia/core/shared/inversify';
17
+ import { injectable, inject, named } from '@theia/core/shared/inversify';
18
18
  import { PluginDeployerResolver, PluginDeployerResolverContext } from '../../../common/plugin-protocol';
19
19
  import * as fs from '@theia/core/shared/fs-extra';
20
20
  import * as path from 'path';
21
21
  import { FileUri } from '@theia/core/lib/node';
22
22
  import URI from '@theia/core/lib/common/uri';
23
+ import { ILogger } from '@theia/core';
23
24
 
24
25
  @injectable()
25
26
  export abstract class LocalPluginDeployerResolver implements PluginDeployerResolver {
27
+
28
+ @inject(ILogger) @named('plugin-ext:LocalPluginDeployerResolver')
29
+ protected readonly logger: ILogger;
30
+
26
31
  async resolve(pluginResolverContext: PluginDeployerResolverContext): Promise<void> {
27
32
  const localPath = await this.resolveLocalPluginPath(pluginResolverContext, this.supportedScheme);
28
33
  if (localPath) {
@@ -48,7 +53,7 @@ export abstract class LocalPluginDeployerResolver implements PluginDeployerResol
48
53
  fsPath = path.resolve(process.cwd(), fsPath);
49
54
  }
50
55
  if (!await fs.pathExists(fsPath)) {
51
- console.warn(`The local plugin referenced by ${pluginResolverContext.getOriginId()} does not exist.`);
56
+ this.logger.warn(`The local plugin referenced by ${pluginResolverContext.getOriginId()} does not exist.`);
52
57
  return null;
53
58
  }
54
59
  return fsPath;