@theia/plugin-ext 1.58.2 → 1.59.0-next.62

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 (86) hide show
  1. package/lib/common/plugin-api-rpc.d.ts +11 -0
  2. package/lib/common/plugin-api-rpc.d.ts.map +1 -1
  3. package/lib/common/plugin-api-rpc.js +10 -1
  4. package/lib/common/plugin-api-rpc.js.map +1 -1
  5. package/lib/hosted/node/hosted-plugin-process.d.ts.map +1 -1
  6. package/lib/hosted/node/hosted-plugin-process.js +0 -1
  7. package/lib/hosted/node/hosted-plugin-process.js.map +1 -1
  8. package/lib/hosted/node/plugin-host-logger.d.ts +3 -0
  9. package/lib/hosted/node/plugin-host-logger.d.ts.map +1 -0
  10. package/lib/hosted/node/plugin-host-logger.js +39 -0
  11. package/lib/hosted/node/plugin-host-logger.js.map +1 -0
  12. package/lib/hosted/node/plugin-host-module.d.ts.map +1 -1
  13. package/lib/hosted/node/plugin-host-module.js +5 -2
  14. package/lib/hosted/node/plugin-host-module.js.map +1 -1
  15. package/lib/main/browser/debug/plugin-debug-service.d.ts.map +1 -1
  16. package/lib/main/browser/debug/plugin-debug-service.js +5 -0
  17. package/lib/main/browser/debug/plugin-debug-service.js.map +1 -1
  18. package/lib/main/browser/logger-main.d.ts +8 -0
  19. package/lib/main/browser/logger-main.d.ts.map +1 -0
  20. package/lib/main/browser/logger-main.js +53 -0
  21. package/lib/main/browser/logger-main.js.map +1 -0
  22. package/lib/main/browser/main-context.d.ts.map +1 -1
  23. package/lib/main/browser/main-context.js +3 -0
  24. package/lib/main/browser/main-context.js.map +1 -1
  25. package/lib/main/browser/plugin-contribution-handler.d.ts.map +1 -1
  26. package/lib/main/browser/plugin-contribution-handler.js.map +1 -1
  27. package/lib/plugin/debug/debug-ext.d.ts +1 -0
  28. package/lib/plugin/debug/debug-ext.d.ts.map +1 -1
  29. package/lib/plugin/debug/debug-ext.js +4 -2
  30. package/lib/plugin/debug/debug-ext.js.map +1 -1
  31. package/lib/plugin/decorations.d.ts +1 -0
  32. package/lib/plugin/decorations.d.ts.map +1 -1
  33. package/lib/plugin/decorations.js +4 -2
  34. package/lib/plugin/decorations.js.map +1 -1
  35. package/lib/plugin/localization-ext.d.ts +1 -0
  36. package/lib/plugin/localization-ext.d.ts.map +1 -1
  37. package/lib/plugin/localization-ext.js +3 -1
  38. package/lib/plugin/localization-ext.js.map +1 -1
  39. package/lib/plugin/logger.d.ts +16 -0
  40. package/lib/plugin/logger.d.ts.map +1 -0
  41. package/lib/plugin/logger.js +56 -0
  42. package/lib/plugin/logger.js.map +1 -0
  43. package/lib/plugin/notebook/notebook-document.js +1 -1
  44. package/lib/plugin/notebook/notebook-document.js.map +1 -1
  45. package/lib/plugin/notebook/notebook-kernels.d.ts +1 -0
  46. package/lib/plugin/notebook/notebook-kernels.d.ts.map +1 -1
  47. package/lib/plugin/notebook/notebook-kernels.js +19 -10
  48. package/lib/plugin/notebook/notebook-kernels.js.map +1 -1
  49. package/lib/plugin/notebook/notebooks.d.ts +4 -3
  50. package/lib/plugin/notebook/notebooks.d.ts.map +1 -1
  51. package/lib/plugin/notebook/notebooks.js +4 -2
  52. package/lib/plugin/notebook/notebooks.js.map +1 -1
  53. package/lib/plugin/plugin-context.d.ts.map +1 -1
  54. package/lib/plugin/plugin-context.js +5 -3
  55. package/lib/plugin/plugin-context.js.map +1 -1
  56. package/lib/plugin/plugin-manager.d.ts +1 -0
  57. package/lib/plugin/plugin-manager.d.ts.map +1 -1
  58. package/lib/plugin/plugin-manager.js +12 -10
  59. package/lib/plugin/plugin-manager.js.map +1 -1
  60. package/lib/plugin/uri-ext.d.ts.map +1 -1
  61. package/lib/plugin/uri-ext.js +0 -1
  62. package/lib/plugin/uri-ext.js.map +1 -1
  63. package/lib/plugin/workspace.d.ts +1 -0
  64. package/lib/plugin/workspace.d.ts.map +1 -1
  65. package/lib/plugin/workspace.js +6 -4
  66. package/lib/plugin/workspace.js.map +1 -1
  67. package/package.json +30 -30
  68. package/src/common/plugin-api-rpc.ts +23 -10
  69. package/src/hosted/node/hosted-plugin-process.ts +1 -2
  70. package/src/hosted/node/plugin-host-logger.ts +39 -0
  71. package/src/hosted/node/plugin-host-module.ts +5 -1
  72. package/src/main/browser/debug/plugin-debug-service.ts +5 -0
  73. package/src/main/browser/logger-main.ts +53 -0
  74. package/src/main/browser/main-context.ts +4 -0
  75. package/src/main/browser/plugin-contribution-handler.ts +8 -1
  76. package/src/plugin/debug/debug-ext.ts +5 -2
  77. package/src/plugin/decorations.ts +5 -2
  78. package/src/plugin/localization-ext.ts +4 -1
  79. package/src/plugin/logger.ts +66 -0
  80. package/src/plugin/notebook/notebook-document.ts +1 -1
  81. package/src/plugin/notebook/notebook-kernels.ts +23 -11
  82. package/src/plugin/notebook/notebooks.ts +8 -5
  83. package/src/plugin/plugin-context.ts +6 -3
  84. package/src/plugin/plugin-manager.ts +15 -10
  85. package/src/plugin/uri-ext.ts +0 -1
  86. package/src/plugin/workspace.ts +7 -4
@@ -36,6 +36,7 @@ import { toUriComponents } from '../../main/browser/hierarchy/hierarchy-types-co
36
36
  import type * as theia from '@theia/plugin';
37
37
  import { WebviewsExtImpl } from '../webviews';
38
38
  import { WorkspaceExtImpl } from '../workspace';
39
+ import { PluginLogger } from '../logger';
39
40
 
40
41
  interface KernelData {
41
42
  extensionId: string;
@@ -53,6 +54,8 @@ export class NotebookKernelsExtImpl implements NotebookKernelsExt {
53
54
 
54
55
  private readonly proxy: NotebookKernelsMain;
55
56
 
57
+ private readonly logger: PluginLogger;
58
+
56
59
  private kernelDetectionTasks = new Map<number, theia.NotebookControllerDetectionTask>();
57
60
  private currentKernelDetectionTaskHandle = 0;
58
61
 
@@ -70,6 +73,7 @@ export class NotebookKernelsExtImpl implements NotebookKernelsExt {
70
73
  workspace: WorkspaceExtImpl
71
74
  ) {
72
75
  this.proxy = rpc.getProxy(PLUGIN_RPC_CONTEXT.NOTEBOOK_KERNELS_MAIN);
76
+ this.logger = new PluginLogger(rpc, 'notebook');
73
77
 
74
78
  // call onDidChangeSelection for all kernels after trust is granted to inform extensions they can set the kernel as assoiciated
75
79
  // the jupyter extension for example does not set kernel association after trust is granted
@@ -97,9 +101,9 @@ export class NotebookKernelsExtImpl implements NotebookKernelsExt {
97
101
  const handle = this.currentHandle++;
98
102
  const that = this;
99
103
 
100
- console.debug(`NotebookController[${handle}], CREATED by ${extension.id}, ${id}`);
104
+ this.logger.debug(`NotebookController[${handle}], CREATED by ${extension.id}, ${id}`);
101
105
 
102
- const defaultExecuteHandler = () => console.warn(`NO execute handler from notebook controller '${data.id}' of extension: '${extension.id}'`);
106
+ const defaultExecuteHandler = () => this.logger.warn(`NO execute handler from notebook controller '${data.id}' of extension: '${extension.id}'`);
103
107
 
104
108
  let isDisposed = false;
105
109
  const commandDisposables = new DisposableCollection();
@@ -122,7 +126,7 @@ export class NotebookKernelsExtImpl implements NotebookKernelsExt {
122
126
 
123
127
  this.proxy.$addKernel(handle, data).catch(err => {
124
128
  // this can happen when a kernel with that ID is already registered
125
- console.log(err);
129
+ this.logger.info(err);
126
130
  isDisposed = true;
127
131
  });
128
132
 
@@ -206,7 +210,7 @@ export class NotebookKernelsExtImpl implements NotebookKernelsExt {
206
210
  throw new Error('notebook controller is DISPOSED');
207
211
  }
208
212
  if (!associatedNotebooks.has(cell.notebook.uri.toString())) {
209
- console.debug(`NotebookController[${handle}] NOT associated to notebook, associated to THESE notebooks:`,
213
+ that.logger.debug(`NotebookController[${handle}] NOT associated to notebook, associated to THESE notebooks:`,
210
214
  Array.from(associatedNotebooks.keys()).map(u => u.toString()));
211
215
  throw new Error(`notebook controller is NOT associated to notebook: ${cell.notebook.uri.toString()}`);
212
216
  }
@@ -214,7 +218,7 @@ export class NotebookKernelsExtImpl implements NotebookKernelsExt {
214
218
  },
215
219
  dispose: () => {
216
220
  if (!isDisposed) {
217
- console.debug(`NotebookController[${handle}], DISPOSED`);
221
+ that.logger.debug(`NotebookController[${handle}] DISPOSED`);
218
222
  isDisposed = true;
219
223
  this.kernelData.delete(handle);
220
224
  commandDisposables.dispose();
@@ -257,7 +261,7 @@ export class NotebookKernelsExtImpl implements NotebookKernelsExt {
257
261
  if (this.activeExecutions.has(cellObj.uri.toString())) {
258
262
  throw new Error(`duplicate execution for ${cellObj.uri}`);
259
263
  }
260
- const execution = new NotebookCellExecutionTask(controllerId, cellObj, this.proxy);
264
+ const execution = new NotebookCellExecutionTask(controllerId, cellObj, this.proxy, this.logger);
261
265
  this.activeExecutions.set(cellObj.uri.toString(), execution);
262
266
  const listener = execution.onDidChangeState(() => {
263
267
  if (execution.state === NotebookCellExecutionTaskState.Resolved) {
@@ -318,7 +322,7 @@ export class NotebookKernelsExtImpl implements NotebookKernelsExt {
318
322
  } else {
319
323
  obj.associatedNotebooks.delete(notebook.uri.toString());
320
324
  }
321
- console.debug(`NotebookController[${handle}] ASSOCIATE notebook`, notebook.uri.toString(), selected);
325
+ this.logger.debug(`NotebookController[${handle}] ASSOCIATE notebook`, notebook.uri.toString(), selected);
322
326
  // send event
323
327
  obj.onDidChangeSelection.fire({
324
328
  selected: selected,
@@ -344,10 +348,13 @@ export class NotebookKernelsExtImpl implements NotebookKernelsExt {
344
348
  }
345
349
 
346
350
  try {
347
- console.debug(`NotebookController[${handle}] EXECUTE cells`, document.uri.toString(), cells.length);
351
+ this.logger.debug(`NotebookController[${handle}] EXECUTE cells`, {
352
+ notebook: document.uri.toString(),
353
+ cells: cells.map(e => e.index)
354
+ });
348
355
  await obj.controller.executeHandler.call(obj.controller, cells, document.apiNotebook, obj.controller);
349
356
  } catch (err) {
350
- console.error(`NotebookController[${handle}] execute cells FAILED`, err);
357
+ this.logger.error(`NotebookController[${handle}] EXECUTE cells FAILED`, err);
351
358
  }
352
359
 
353
360
  }
@@ -428,12 +435,14 @@ class NotebookCellExecutionTask implements Disposable {
428
435
  constructor(
429
436
  controllerId: string,
430
437
  private readonly cell: Cell,
431
- private readonly proxy: NotebookKernelsMain
438
+ private readonly proxy: NotebookKernelsMain,
439
+ private readonly logger: PluginLogger
432
440
  ) {
433
441
  this.collector = new TimeoutBasedCollector(10, updates => this.update(updates));
434
442
 
435
443
  this.executionOrder = cell.internalMetadata.executionOrder;
436
444
  this.proxy.$createExecution(this._handle, controllerId, this.cell.notebookDocument.uri, this.cell.handle);
445
+ this.logger.debug(`NotebookCellExecutionTask[${this._handle}] CREATED`, { controllerId, cell: this.cell.uri.toString() });
437
446
  }
438
447
 
439
448
  cancel(): void {
@@ -487,18 +496,21 @@ class NotebookCellExecutionTask implements Disposable {
487
496
  private async updateOutputs(outputs: NotebookCellOutput | NotebookCellOutput[], cell: theia.NotebookCell | undefined, append: boolean): Promise<void> {
488
497
  const handle = this.cellIndexToHandle(cell);
489
498
  const outputDtos = this.validateAndConvertOutputs(Array.isArray(outputs) ? outputs : [outputs]);
499
+ this.logger.debug(`NotebookCellExecutionTask[${this._handle}] received new outputs from plugin`, { append, outputs: outputDtos });
490
500
  return this.updateSoon(
491
501
  {
492
502
  editType: CellExecutionUpdateType.Output,
493
503
  cellHandle: handle,
494
504
  append,
495
505
  outputs: outputDtos
496
- });
506
+ }
507
+ );
497
508
  }
498
509
 
499
510
  private async updateOutputItems(items: theia.NotebookCellOutputItem | theia.NotebookCellOutputItem[],
500
511
  output: theia.NotebookCellOutput, append: boolean): Promise<void> {
501
512
  items = NotebookCellOutputConverter.ensureUniqueMimeTypes(Array.isArray(items) ? items : [items], true);
513
+ this.logger.debug(`NotebookCellExecutionTask[${this._handle}] received new outputs from plugin`, { append, items });
502
514
  return this.updateSoon({
503
515
  editType: CellExecutionUpdateType.OutputItems,
504
516
  items: items.map(NotebookCellOutputItem.from),
@@ -37,6 +37,7 @@ import { NotebookEditor } from './notebook-editor';
37
37
  import { EditorsAndDocumentsExtImpl } from '../editors-and-documents';
38
38
  import { DocumentsExtImpl } from '../documents';
39
39
  import { CellUri, NotebookCellModelResource, NotebookModelResource } from '@theia/notebook/lib/common';
40
+ import { PluginLogger } from '../logger';
40
41
 
41
42
  export class NotebooksExtImpl implements NotebooksExt {
42
43
 
@@ -68,9 +69,10 @@ export class NotebooksExtImpl implements NotebooksExt {
68
69
  private readonly editors = new Map<string, NotebookEditor>();
69
70
  private statusBarRegistry = new Cache<Disposable>('NotebookCellStatusBarCache');
70
71
 
71
- private notebookProxy: NotebooksMain;
72
- private notebookDocumentsProxy: NotebookDocumentsMain;
73
- private notebookEditors: NotebookEditorsMain;
72
+ private readonly notebookProxy: NotebooksMain;
73
+ private readonly notebookDocumentsProxy: NotebookDocumentsMain;
74
+ private readonly notebookEditors: NotebookEditorsMain;
75
+ private readonly logger: PluginLogger;
74
76
 
75
77
  constructor(
76
78
  rpc: RPCProtocol,
@@ -82,6 +84,7 @@ export class NotebooksExtImpl implements NotebooksExt {
82
84
  this.notebookProxy = rpc.getProxy(PLUGIN_RPC_CONTEXT.NOTEBOOKS_MAIN);
83
85
  this.notebookDocumentsProxy = rpc.getProxy(PLUGIN_RPC_CONTEXT.NOTEBOOK_DOCUMENTS_MAIN);
84
86
  this.notebookEditors = rpc.getProxy(PLUGIN_RPC_CONTEXT.NOTEBOOK_EDITORS_MAIN);
87
+ this.logger = new PluginLogger(rpc, 'notebook');
85
88
 
86
89
  commands.registerArgumentProcessor({
87
90
  processArgument: arg => {
@@ -254,7 +257,7 @@ export class NotebooksExtImpl implements NotebooksExt {
254
257
  const uri = TheiaURI.from(modelData.uri);
255
258
 
256
259
  if (this.documents.has(uri.toString())) {
257
- throw new Error(`adding EXISTING notebook ${uri} `);
260
+ throw new Error(`cannot add EXISTING notebook ${uri}`);
258
261
  }
259
262
 
260
263
  const document = new NotebookDocument(
@@ -334,7 +337,7 @@ export class NotebooksExtImpl implements NotebooksExt {
334
337
  } else if (delta.newActiveEditor) {
335
338
  const activeEditor = this.editors.get(delta.newActiveEditor);
336
339
  if (!activeEditor) {
337
- console.error(`FAILED to find active notebook editor ${delta.newActiveEditor}`);
340
+ this.logger.error(`FAILED to find active notebook editor '${delta.newActiveEditor}'.`);
338
341
  }
339
342
  this.activeNotebookEditor = this.editors.get(delta.newActiveEditor);
340
343
  this.onDidChangeActiveNotebookEditorEmitter.fire(this.activeNotebookEditor?.apiEditor);
@@ -287,6 +287,7 @@ import { NotebookEditorsExtImpl } from './notebook/notebook-editors';
287
287
  import { TestingExtImpl } from './tests';
288
288
  import { UriExtImpl } from './uri-ext';
289
289
  import { isObject } from '@theia/core';
290
+ import { PluginLogger } from './logger';
290
291
 
291
292
  export function createAPIObject<T extends Object>(rawObject: T): T {
292
293
  return new Proxy(rawObject, {
@@ -353,6 +354,8 @@ export function createAPIFactory(
353
354
  const uriExt = rpc.set(MAIN_RPC_CONTEXT.URI_EXT, new UriExtImpl(rpc));
354
355
  rpc.set(MAIN_RPC_CONTEXT.DEBUG_EXT, debugExt);
355
356
 
357
+ const commandLogger = new PluginLogger(rpc, 'commands-plugin');
358
+
356
359
  return function (plugin: InternalPlugin): typeof theia {
357
360
  const authentication: typeof theia.authentication = {
358
361
  registerAuthenticationProvider(id: string, label: string, provider: theia.AuthenticationProvider, options?: theia.AuthenticationProviderOptions): theia.Disposable {
@@ -393,7 +396,7 @@ export function createAPIFactory(
393
396
  const internalHandler = (...args: any[]): any => {
394
397
  const activeTextEditor = editors.getActiveEditor();
395
398
  if (!activeTextEditor) {
396
- console.warn('Cannot execute ' + command + ' because there is no active text editor.');
399
+ commandLogger.warn('Cannot execute ' + command + ' because there is no active text editor.');
397
400
  return undefined;
398
401
  }
399
402
 
@@ -402,10 +405,10 @@ export function createAPIFactory(
402
405
  handler.apply(thisArg, args);
403
406
  }).then(result => {
404
407
  if (!result) {
405
- console.warn('Edits from command ' + command + ' were not applied.');
408
+ commandLogger.warn('Edits from command ' + command + ' were not applied.');
406
409
  }
407
410
  }, err => {
408
- console.warn('An error occurred while running command ' + command, err);
411
+ commandLogger.warn('An error occurred while running command ' + command, err);
409
412
  });
410
413
  };
411
414
  return commandIsDeclaredInPackage(command, plugin.rawModel)
@@ -47,6 +47,7 @@ import { URI as Uri } from './types-impl';
47
47
  import { InternalSecretsExt, SecretStorageExt } from '../plugin/secrets-ext';
48
48
  import { PluginExt } from './plugin-context';
49
49
  import { Deferred } from '@theia/core/lib/common/promise-util';
50
+ import { PluginLogger } from './logger';
50
51
 
51
52
  export interface PluginHost {
52
53
 
@@ -120,6 +121,7 @@ export abstract class AbstractPluginManagerExtImpl<P extends Record<string, any>
120
121
  private onDidChangeEmitter = new Emitter<void>();
121
122
  private messageRegistryProxy: MessageRegistryMain;
122
123
  private notificationMain: NotificationMain;
124
+ private logger: PluginLogger;
123
125
 
124
126
  protected jsonValidation: PluginJsonValidationContribution[] = [];
125
127
  protected pluginKind = ExtensionKind.UI;
@@ -129,6 +131,7 @@ export abstract class AbstractPluginManagerExtImpl<P extends Record<string, any>
129
131
  initialize(): void {
130
132
  this.messageRegistryProxy = this.rpc.getProxy(PLUGIN_RPC_CONTEXT.MESSAGE_REGISTRY_MAIN);
131
133
  this.notificationMain = this.rpc.getProxy(PLUGIN_RPC_CONTEXT.NOTIFICATION_MAIN);
134
+ this.logger = new PluginLogger(this.rpc, 'plugin-manager');
132
135
  }
133
136
 
134
137
  setPluginHost(pluginHost: PluginHost): void {
@@ -176,7 +179,7 @@ export abstract class AbstractPluginManagerExtImpl<P extends Record<string, any>
176
179
  result = plugin.stopFn();
177
180
  } catch (e) {
178
181
  if (!options.terminating) {
179
- console.error(`[${id}]: failed to stop:`, e);
182
+ this.logger.error(`[${id}]: failed to stop:`, e);
180
183
  }
181
184
  }
182
185
  }
@@ -188,7 +191,7 @@ export abstract class AbstractPluginManagerExtImpl<P extends Record<string, any>
188
191
  subscription.dispose();
189
192
  } catch (e) {
190
193
  if (!options.terminating) {
191
- console.error(`[${id}]: failed to dispose subscription:`, e);
194
+ this.logger.error(`[${id}]: failed to dispose subscription:`, e);
192
195
  }
193
196
  }
194
197
  }
@@ -198,7 +201,7 @@ export abstract class AbstractPluginManagerExtImpl<P extends Record<string, any>
198
201
  await result;
199
202
  } catch (e) {
200
203
  if (!options.terminating) {
201
- console.error(`[${id}]: failed to stop:`, e);
204
+ this.logger.error(`[${id}]: failed to stop:`, e);
202
205
  }
203
206
  }
204
207
  }
@@ -248,7 +251,9 @@ export abstract class AbstractPluginManagerExtImpl<P extends Record<string, any>
248
251
  this.setActivation(`onPlugin:${plugin.model.id}`, activation);
249
252
  const unsupportedActivationEvents = activationEvents.filter(e => !this.isSupportedActivationEvent(e));
250
253
  if (unsupportedActivationEvents.length) {
251
- console.warn(`Unsupported activation events: ${unsupportedActivationEvents.join(', ')}, please open an issue: https://github.com/eclipse-theia/theia/issues/new`);
254
+ this.logger.warn(
255
+ `Unsupported activation events: ${unsupportedActivationEvents.join(', ')}, please open an issue: https://github.com/eclipse-theia/theia/issues/new`
256
+ );
252
257
  }
253
258
  for (let activationEvent of activationEvents) {
254
259
  if (activationEvent === 'onUri') {
@@ -293,10 +298,10 @@ export abstract class AbstractPluginManagerExtImpl<P extends Record<string, any>
293
298
  if (dependency) {
294
299
  const loadedSuccessfully = await this.loadPlugin(dependency, configStorage, visited);
295
300
  if (!loadedSuccessfully) {
296
- throw new Error(`Dependent extension '${dependency.model.displayName || dependency.model.id}' failed to activate.`);
301
+ throw new Error(`Dependent plugin '${dependency.model.displayName || dependency.model.id}' failed to activate.`);
297
302
  }
298
303
  } else {
299
- throw new Error(`Dependent extension '${dependencyId}' is not installed.`);
304
+ throw new Error(`Dependent plugin '${dependencyId}' is not installed.`);
300
305
  }
301
306
  }
302
307
  }
@@ -307,9 +312,9 @@ export abstract class AbstractPluginManagerExtImpl<P extends Record<string, any>
307
312
  await this.startPlugin(plugin, configStorage, pluginMain);
308
313
  return true;
309
314
  } catch (err) {
310
- const message = `Activating extension '${plugin.model.displayName || plugin.model.name}' failed:`;
315
+ const message = `Activating plugin '${plugin.model.displayName || plugin.model.name}' failed:`;
311
316
  this.messageRegistryProxy.$showMessage(MainMessageType.Error, message + ' ' + err.message, {}, []);
312
- console.error(message, err);
317
+ this.logger.error(message, err);
313
318
  return false;
314
319
  } finally {
315
320
  this.notificationMain.$stopProgress(progressId);
@@ -410,11 +415,11 @@ export abstract class AbstractPluginManagerExtImpl<P extends Record<string, any>
410
415
  if (typeof pluginMain[plugin.lifecycle.startMethod] === 'function') {
411
416
  await this.localization.initializeLocalizedMessages(plugin, this.envExt.language);
412
417
  const pluginExport = await pluginMain[plugin.lifecycle.startMethod].apply(getGlobal(), [pluginContext]);
413
- console.log(`calling activation function on ${id}`);
418
+ this.logger.debug(`Calling activation function on plugin ${id}`);
414
419
  this.activatedPlugins.set(plugin.model.id, new ActivatedPlugin(pluginContext, pluginExport, stopFn));
415
420
  } else {
416
421
  // https://github.com/TypeFox/vscode/blob/70b8db24a37fafc77247de7f7cb5bb0195120ed0/src/vs/workbench/api/common/extHostExtensionService.ts#L400-L401
417
- console.log(`plugin ${id}, ${plugin.lifecycle.startMethod} method is undefined so the module is the extension's exports`);
422
+ this.logger.debug(`Plugin ${id}, ${plugin.lifecycle.startMethod} method is undefined so the module is the extension's exports`);
418
423
  this.activatedPlugins.set(plugin.model.id, new ActivatedPlugin(pluginContext, pluginMain));
419
424
  }
420
425
  }
@@ -31,7 +31,6 @@ export class UriExtImpl implements UriExt {
31
31
 
32
32
  constructor(readonly rpc: RPCProtocol) {
33
33
  this.proxy = rpc.getProxy(PLUGIN_RPC_CONTEXT.URI_MAIN);
34
- console.log(this.proxy);
35
34
  }
36
35
 
37
36
  registerUriHandler(handler: theia.UriHandler, plugin: PluginInfo): theia.Disposable {
@@ -44,6 +44,7 @@ import { MessageRegistryExt } from './message-registry';
44
44
  import * as Converter from './type-converters';
45
45
  import { FileStat } from '@theia/filesystem/lib/common/files';
46
46
  import { isUndefinedOrNull, isUndefined } from '../common/types';
47
+ import { PluginLogger } from './logger';
47
48
 
48
49
  @injectable()
49
50
  export class WorkspaceExtImpl implements WorkspaceExt {
@@ -58,6 +59,7 @@ export class WorkspaceExtImpl implements WorkspaceExt {
58
59
  protected messageService: MessageRegistryExt;
59
60
 
60
61
  private proxy: WorkspaceMain;
62
+ private logger: PluginLogger;
61
63
 
62
64
  private workspaceFoldersChangedEmitter = new Emitter<theia.WorkspaceFoldersChangeEvent>();
63
65
  public readonly onDidChangeWorkspaceFolders: Event<theia.WorkspaceFoldersChangeEvent> = this.workspaceFoldersChangedEmitter.event;
@@ -77,6 +79,7 @@ export class WorkspaceExtImpl implements WorkspaceExt {
77
79
  @postConstruct()
78
80
  initialize(): void {
79
81
  this.proxy = this.rpc.getProxy(Ext.WORKSPACE_MAIN);
82
+ this.logger = new PluginLogger(this.rpc, 'workspace');
80
83
  }
81
84
 
82
85
  get rootPath(): string | undefined {
@@ -267,7 +270,7 @@ export class WorkspaceExtImpl implements WorkspaceExt {
267
270
  throw new Error(`Text Content Document Provider for scheme '${scheme}' is already registered`);
268
271
  } else if (this.documentContentProviders.has(scheme)) {
269
272
  // TODO: we should be able to handle multiple registrations, but for now we should ensure that it doesn't crash plugin activation.
270
- console.warn(`Repeat registration of TextContentDocumentProvider for scheme '${scheme}'. This registration will be ignored.`);
273
+ this.logger.warn(`Repeat registration of TextContentDocumentProvider for scheme '${scheme}'. This registration will be ignored.`);
271
274
  return { dispose: () => { } };
272
275
  }
273
276
 
@@ -472,7 +475,7 @@ export class WorkspaceExtImpl implements WorkspaceExt {
472
475
 
473
476
  this.canonicalUriProviders.set(scheme, provider);
474
477
  this.proxy.$registerCanonicalUriProvider(scheme).catch(e => {
475
- console.error(`Canonical URI provider for scheme: '${scheme}' already exists globally`);
478
+ this.logger.error(`Canonical URI provider for scheme: '${scheme}' already exists globally`);
476
479
  this.canonicalUriProviders.delete(scheme);
477
480
  });
478
481
  const result = Disposable.create(() => { this.proxy.$unregisterCanonicalUriProvider(scheme); });
@@ -481,7 +484,7 @@ export class WorkspaceExtImpl implements WorkspaceExt {
481
484
 
482
485
  $disposeCanonicalUriProvider(scheme: string): void {
483
486
  if (!this.canonicalUriProviders.delete(scheme)) {
484
- console.warn(`No canonical uri provider registered for '${scheme}'`);
487
+ this.logger.warn(`diposeCanonicalUriProvider: No canonical uri provider registered for '${scheme}'`);
485
488
  }
486
489
  }
487
490
 
@@ -494,7 +497,7 @@ export class WorkspaceExtImpl implements WorkspaceExt {
494
497
  const parsed = URI.parse(uri);
495
498
  const provider = this.canonicalUriProviders.get(parsed.scheme);
496
499
  if (!provider) {
497
- console.warn(`No canonical uri provider registered for '${parsed.scheme}'`);
500
+ this.logger.warn(`provideCanonicalUri: No canonical uri provider registered for '${parsed.scheme}'`);
498
501
  return undefined;
499
502
  }
500
503
  const result = await provider.provideCanonicalUri(parsed, { targetScheme: targetScheme }, token);