@theia/plugin-ext 1.73.0-next.20 → 1.73.0-next.24

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 (47) hide show
  1. package/lib/hosted/node/hosted-plugin-localization-service.d.ts +2 -1
  2. package/lib/hosted/node/hosted-plugin-localization-service.d.ts.map +1 -1
  3. package/lib/hosted/node/hosted-plugin-localization-service.js +6 -1
  4. package/lib/hosted/node/hosted-plugin-localization-service.js.map +1 -1
  5. package/lib/hosted/node/plugin-deployer-handler-impl.js +4 -3
  6. package/lib/hosted/node/plugin-deployer-handler-impl.js.map +1 -1
  7. package/lib/hosted/node/scanners/scanner-theia.d.ts +2 -0
  8. package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
  9. package/lib/hosted/node/scanners/scanner-theia.js +55 -49
  10. package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
  11. package/lib/main/browser/debug/plugin-debug-service.d.ts +2 -1
  12. package/lib/main/browser/debug/plugin-debug-service.d.ts.map +1 -1
  13. package/lib/main/browser/debug/plugin-debug-service.js +8 -3
  14. package/lib/main/browser/debug/plugin-debug-service.js.map +1 -1
  15. package/lib/main/browser/languages-main.d.ts +2 -0
  16. package/lib/main/browser/languages-main.d.ts.map +1 -1
  17. package/lib/main/browser/languages-main.js +7 -1
  18. package/lib/main/browser/languages-main.js.map +1 -1
  19. package/lib/main/browser/plugin-contribution-handler.d.ts +2 -0
  20. package/lib/main/browser/plugin-contribution-handler.d.ts.map +1 -1
  21. package/lib/main/browser/plugin-contribution-handler.js +10 -4
  22. package/lib/main/browser/plugin-contribution-handler.js.map +1 -1
  23. package/lib/main/browser/webview/webview-resource-cache.d.ts +2 -0
  24. package/lib/main/browser/webview/webview-resource-cache.d.ts.map +1 -1
  25. package/lib/main/browser/webview/webview-resource-cache.js +7 -1
  26. package/lib/main/browser/webview/webview-resource-cache.js.map +1 -1
  27. package/lib/main/browser/webview/webview.d.ts +2 -1
  28. package/lib/main/browser/webview/webview.d.ts.map +1 -1
  29. package/lib/main/browser/webview/webview.js +7 -1
  30. package/lib/main/browser/webview/webview.js.map +1 -1
  31. package/lib/main/node/plugin-deployer-impl.js +2 -1
  32. package/lib/main/node/plugin-deployer-impl.js.map +1 -1
  33. package/lib/plugin/languages/diagnostics.d.ts +4 -1
  34. package/lib/plugin/languages/diagnostics.d.ts.map +1 -1
  35. package/lib/plugin/languages/diagnostics.js +22 -9
  36. package/lib/plugin/languages/diagnostics.js.map +1 -1
  37. package/package.json +29 -29
  38. package/src/hosted/node/hosted-plugin-localization-service.ts +6 -3
  39. package/src/hosted/node/plugin-deployer-handler-impl.ts +5 -5
  40. package/src/hosted/node/scanners/scanner-theia.ts +54 -50
  41. package/src/main/browser/debug/plugin-debug-service.ts +7 -5
  42. package/src/main/browser/languages-main.ts +6 -2
  43. package/src/main/browser/plugin-contribution-handler.ts +8 -4
  44. package/src/main/browser/webview/webview-resource-cache.ts +6 -2
  45. package/src/main/browser/webview/webview.ts +6 -3
  46. package/src/main/node/plugin-deployer-impl.ts +2 -2
  47. package/src/plugin/languages/diagnostics.ts +28 -10
@@ -16,7 +16,7 @@
16
16
 
17
17
  /* eslint-disable @theia/localization-check */
18
18
 
19
- import { inject, injectable, unmanaged } from '@theia/core/shared/inversify';
19
+ import { inject, injectable, unmanaged, named } from '@theia/core/shared/inversify';
20
20
  import {
21
21
  AutoClosingPair,
22
22
  AutoClosingPairConditional,
@@ -82,6 +82,7 @@ import { ColorDefinition } from '@theia/core/lib/common/color';
82
82
  import { CSSIcon } from '@theia/core/lib/common/markdown-rendering/icon-utilities';
83
83
  import { PluginUriFactory } from './plugin-uri-factory';
84
84
  import { PreferenceScope } from '@theia/core/lib/common/preferences/preference-scope';
85
+ import { ILogger } from '@theia/core';
85
86
 
86
87
  const colorIdPattern = '^\\w+[.\\w+]*$';
87
88
  const iconIdPattern = `^${CSSIcon.iconNameSegment}(-${CSSIcon.iconNameSegment})+$`;
@@ -284,6 +285,9 @@ export class TheiaPluginScanner extends AbstractPluginScanner {
284
285
  super('theiaPlugin', 'backend-init-theia');
285
286
  }
286
287
 
288
+ @inject(ILogger) @named('plugin-ext:TheiaPluginScanner')
289
+ protected readonly logger: ILogger;
290
+
287
291
  protected getEntryPoint(plugin: PluginPackage): PluginEntryPoint {
288
292
  const result: PluginEntryPoint = {
289
293
  frontend: plugin.theiaPlugin!.frontend,
@@ -335,7 +339,7 @@ export class TheiaPluginScanner extends AbstractPluginScanner {
335
339
  }
336
340
  }
337
341
  } catch (err) {
338
- console.error(`Could not read '${rawPlugin.name}' contribution 'configuration'.`, rawPlugin.contributes.configuration, err);
342
+ this.logger.error(`Could not read '${rawPlugin.name}' contribution 'configuration'.`, rawPlugin.contributes.configuration, err);
339
343
  }
340
344
 
341
345
  const configurationDefaults = rawPlugin.contributes.configurationDefaults;
@@ -346,7 +350,7 @@ export class TheiaPluginScanner extends AbstractPluginScanner {
346
350
  contributions.submenus = this.readSubmenus(rawPlugin.contributes.submenus, rawPlugin);
347
351
  }
348
352
  } catch (err) {
349
- console.error(`Could not read '${rawPlugin.name}' contribution 'submenus'.`, rawPlugin.contributes.submenus, err);
353
+ this.logger.error(`Could not read '${rawPlugin.name}' contribution 'submenus'.`, rawPlugin.contributes.submenus, err);
350
354
  }
351
355
 
352
356
  try {
@@ -355,7 +359,7 @@ export class TheiaPluginScanner extends AbstractPluginScanner {
355
359
  contributions.customEditors = customEditors;
356
360
  }
357
361
  } catch (err) {
358
- console.error(`Could not read '${rawPlugin.name}' contribution 'customEditors'.`, rawPlugin.contributes.customEditors, err);
362
+ this.logger.error(`Could not read '${rawPlugin.name}' contribution 'customEditors'.`, rawPlugin.contributes.customEditors, err);
359
363
  }
360
364
 
361
365
  try {
@@ -374,7 +378,7 @@ export class TheiaPluginScanner extends AbstractPluginScanner {
374
378
  }
375
379
  }
376
380
  } catch (err) {
377
- console.error(`Could not read '${rawPlugin.name}' contribution 'viewsContainers'.`, rawPlugin.contributes.viewsContainers, err);
381
+ this.logger.error(`Could not read '${rawPlugin.name}' contribution 'viewsContainers'.`, rawPlugin.contributes.viewsContainers, err);
378
382
  }
379
383
 
380
384
  try {
@@ -387,7 +391,7 @@ export class TheiaPluginScanner extends AbstractPluginScanner {
387
391
  }
388
392
  }
389
393
  } catch (err) {
390
- console.error(`Could not read '${rawPlugin.name}' contribution 'views'.`, rawPlugin.contributes.views, err);
394
+ this.logger.error(`Could not read '${rawPlugin.name}' contribution 'views'.`, rawPlugin.contributes.views, err);
391
395
  }
392
396
 
393
397
  try {
@@ -395,7 +399,7 @@ export class TheiaPluginScanner extends AbstractPluginScanner {
395
399
  contributions.viewsWelcome = this.readViewsWelcome(rawPlugin.contributes!.viewsWelcome, rawPlugin.contributes.views);
396
400
  }
397
401
  } catch (err) {
398
- console.error(`Could not read '${rawPlugin.name}' contribution 'viewsWelcome'.`, rawPlugin.contributes.viewsWelcome, err);
402
+ this.logger.error(`Could not read '${rawPlugin.name}' contribution 'viewsWelcome'.`, rawPlugin.contributes.viewsWelcome, err);
399
403
  }
400
404
 
401
405
  try {
@@ -405,7 +409,7 @@ export class TheiaPluginScanner extends AbstractPluginScanner {
405
409
  contributions.commands = commands.map(command => this.readCommand(command, rawPlugin));
406
410
  }
407
411
  } catch (err) {
408
- console.error(`Could not read '${rawPlugin.name}' contribution 'commands'.`, rawPlugin.contributes!.commands, err);
412
+ this.logger.error(`Could not read '${rawPlugin.name}' contribution 'commands'.`, rawPlugin.contributes!.commands, err);
409
413
  }
410
414
 
411
415
  try {
@@ -418,7 +422,7 @@ export class TheiaPluginScanner extends AbstractPluginScanner {
418
422
  }
419
423
  }
420
424
  } catch (err) {
421
- console.error(`Could not read '${rawPlugin.name}' contribution 'menus'.`, rawPlugin.contributes.menus, err);
425
+ this.logger.error(`Could not read '${rawPlugin.name}' contribution 'menus'.`, rawPlugin.contributes.menus, err);
422
426
  }
423
427
 
424
428
  try {
@@ -427,7 +431,7 @@ export class TheiaPluginScanner extends AbstractPluginScanner {
427
431
  contributions.keybindings = rawKeybindings.map(rawKeybinding => this.readKeybinding(rawKeybinding));
428
432
  }
429
433
  } catch (err) {
430
- console.error(`Could not read '${rawPlugin.name}' contribution 'keybindings'.`, rawPlugin.contributes.keybindings, err);
434
+ this.logger.error(`Could not read '${rawPlugin.name}' contribution 'keybindings'.`, rawPlugin.contributes.keybindings, err);
431
435
  }
432
436
 
433
437
  try {
@@ -436,7 +440,7 @@ export class TheiaPluginScanner extends AbstractPluginScanner {
436
440
  contributions.debuggers = debuggers;
437
441
  }
438
442
  } catch (err) {
439
- console.error(`Could not read '${rawPlugin.name}' contribution 'debuggers'.`, rawPlugin.contributes.debuggers, err);
443
+ this.logger.error(`Could not read '${rawPlugin.name}' contribution 'debuggers'.`, rawPlugin.contributes.debuggers, err);
440
444
  }
441
445
 
442
446
  try {
@@ -445,91 +449,91 @@ export class TheiaPluginScanner extends AbstractPluginScanner {
445
449
  contributions.taskDefinitions = definitions.map(definitionContribution => this.readTaskDefinition(rawPlugin.name, definitionContribution));
446
450
  }
447
451
  } catch (err) {
448
- console.error(`Could not read '${rawPlugin.name}' contribution 'taskDefinitions'.`, rawPlugin.contributes.taskDefinitions, err);
452
+ this.logger.error(`Could not read '${rawPlugin.name}' contribution 'taskDefinitions'.`, rawPlugin.contributes.taskDefinitions, err);
449
453
  }
450
454
 
451
455
  try {
452
456
  contributions.problemMatchers = rawPlugin.contributes.problemMatchers;
453
457
  } catch (err) {
454
- console.error(`Could not read '${rawPlugin.name}' contribution 'problemMatchers'.`, rawPlugin.contributes.problemMatchers, err);
458
+ this.logger.error(`Could not read '${rawPlugin.name}' contribution 'problemMatchers'.`, rawPlugin.contributes.problemMatchers, err);
455
459
  }
456
460
 
457
461
  try {
458
462
  contributions.problemPatterns = rawPlugin.contributes.problemPatterns;
459
463
  } catch (err) {
460
- console.error(`Could not read '${rawPlugin.name}' contribution 'problemPatterns'.`, rawPlugin.contributes.problemPatterns, err);
464
+ this.logger.error(`Could not read '${rawPlugin.name}' contribution 'problemPatterns'.`, rawPlugin.contributes.problemPatterns, err);
461
465
  }
462
466
 
463
467
  try {
464
468
  contributions.resourceLabelFormatters = rawPlugin.contributes.resourceLabelFormatters;
465
469
  } catch (err) {
466
- console.error(`Could not read '${rawPlugin.name}' contribution 'resourceLabelFormatters'.`, rawPlugin.contributes.resourceLabelFormatters, err);
470
+ this.logger.error(`Could not read '${rawPlugin.name}' contribution 'resourceLabelFormatters'.`, rawPlugin.contributes.resourceLabelFormatters, err);
467
471
  }
468
472
 
469
473
  try {
470
474
  contributions.authentication = rawPlugin.contributes.authentication;
471
475
  } catch (err) {
472
- console.error(`Could not read '${rawPlugin.name}' contribution 'authentication'.`, rawPlugin.contributes.authentication, err);
476
+ this.logger.error(`Could not read '${rawPlugin.name}' contribution 'authentication'.`, rawPlugin.contributes.authentication, err);
473
477
  }
474
478
 
475
479
  try {
476
480
  contributions.notebooks = rawPlugin.contributes.notebooks;
477
481
  } catch (err) {
478
- console.error(`Could not read '${rawPlugin.name}' contribution 'notebooks'.`, rawPlugin.contributes.notebooks, err);
482
+ this.logger.error(`Could not read '${rawPlugin.name}' contribution 'notebooks'.`, rawPlugin.contributes.notebooks, err);
479
483
  }
480
484
 
481
485
  try {
482
486
  contributions.notebookRenderer = rawPlugin.contributes.notebookRenderer;
483
487
  } catch (err) {
484
- console.error(`Could not read '${rawPlugin.name}' contribution 'notebook-renderer'.`, rawPlugin.contributes.notebookRenderer, err);
488
+ this.logger.error(`Could not read '${rawPlugin.name}' contribution 'notebook-renderer'.`, rawPlugin.contributes.notebookRenderer, err);
485
489
  }
486
490
 
487
491
  try {
488
492
  contributions.notebookPreload = rawPlugin.contributes.notebookPreload;
489
493
  } catch (err) {
490
- console.error(`Could not read '${rawPlugin.name}' contribution 'notebooks-preload'.`, rawPlugin.contributes.notebookPreload, err);
494
+ this.logger.error(`Could not read '${rawPlugin.name}' contribution 'notebooks-preload'.`, rawPlugin.contributes.notebookPreload, err);
491
495
  }
492
496
 
493
497
  try {
494
498
  contributions.snippets = this.readSnippets(rawPlugin);
495
499
  } catch (err) {
496
- console.error(`Could not read '${rawPlugin.name}' contribution 'snippets'.`, rawPlugin.contributes!.snippets, err);
500
+ this.logger.error(`Could not read '${rawPlugin.name}' contribution 'snippets'.`, rawPlugin.contributes!.snippets, err);
497
501
  }
498
502
 
499
503
  try {
500
504
  contributions.themes = this.readThemes(rawPlugin);
501
505
  } catch (err) {
502
- console.error(`Could not read '${rawPlugin.name}' contribution 'themes'.`, rawPlugin.contributes.themes, err);
506
+ this.logger.error(`Could not read '${rawPlugin.name}' contribution 'themes'.`, rawPlugin.contributes.themes, err);
503
507
  }
504
508
 
505
509
  try {
506
510
  contributions.icons = this.readIcons(rawPlugin);
507
511
  } catch (err) {
508
- console.error(`Could not read '${rawPlugin.name}' contribution 'icons'.`, rawPlugin.contributes.icons, err);
512
+ this.logger.error(`Could not read '${rawPlugin.name}' contribution 'icons'.`, rawPlugin.contributes.icons, err);
509
513
  }
510
514
 
511
515
  try {
512
516
  contributions.iconThemes = this.readIconThemes(rawPlugin);
513
517
  } catch (err) {
514
- console.error(`Could not read '${rawPlugin.name}' contribution 'iconThemes'.`, rawPlugin.contributes.iconThemes, err);
518
+ this.logger.error(`Could not read '${rawPlugin.name}' contribution 'iconThemes'.`, rawPlugin.contributes.iconThemes, err);
515
519
  }
516
520
 
517
521
  try {
518
522
  contributions.colors = this.readColors(rawPlugin);
519
523
  } catch (err) {
520
- console.error(`Could not read '${rawPlugin.name}' contribution 'colors'.`, rawPlugin.contributes.colors, err);
524
+ this.logger.error(`Could not read '${rawPlugin.name}' contribution 'colors'.`, rawPlugin.contributes.colors, err);
521
525
  }
522
526
 
523
527
  try {
524
528
  contributions.terminalProfiles = this.readTerminals(rawPlugin);
525
529
  } catch (err) {
526
- console.error(`Could not read '${rawPlugin.name}' contribution 'terminals'.`, rawPlugin.contributes.terminal, err);
530
+ this.logger.error(`Could not read '${rawPlugin.name}' contribution 'terminals'.`, rawPlugin.contributes.terminal, err);
527
531
  }
528
532
 
529
533
  try {
530
534
  contributions.localizations = this.readLocalizations(rawPlugin);
531
535
  } catch (err) {
532
- console.error(`Could not read '${rawPlugin.name}' contribution 'localizations'.`, rawPlugin.contributes.localizations, err);
536
+ this.logger.error(`Could not read '${rawPlugin.name}' contribution 'localizations'.`, rawPlugin.contributes.localizations, err);
533
537
  }
534
538
 
535
539
  const [languagesResult, grammarsResult] = await Promise.allSettled([
@@ -541,7 +545,7 @@ export class TheiaPluginScanner extends AbstractPluginScanner {
541
545
  if (languagesResult.status === 'fulfilled') {
542
546
  contributions.languages = languagesResult.value;
543
547
  } else {
544
- console.error(`Could not read '${rawPlugin.name}' contribution 'languages'.`, rawPlugin.contributes.languages, languagesResult.reason);
548
+ this.logger.error(`Could not read '${rawPlugin.name}' contribution 'languages'.`, rawPlugin.contributes.languages, languagesResult.reason);
545
549
  }
546
550
  }
547
551
 
@@ -549,7 +553,7 @@ export class TheiaPluginScanner extends AbstractPluginScanner {
549
553
  if (grammarsResult.status === 'fulfilled') {
550
554
  contributions.grammars = grammarsResult.value;
551
555
  } else {
552
- console.error(`Could not read '${rawPlugin.name}' contribution 'grammars'.`, rawPlugin.contributes.grammars, grammarsResult.reason);
556
+ this.logger.error(`Could not read '${rawPlugin.name}' contribution 'grammars'.`, rawPlugin.contributes.grammars, grammarsResult.reason);
553
557
  }
554
558
  }
555
559
 
@@ -624,20 +628,20 @@ export class TheiaPluginScanner extends AbstractPluginScanner {
624
628
  const result: ColorDefinition[] = [];
625
629
  for (const contribution of pck.contributes.colors) {
626
630
  if (typeof contribution.id !== 'string' || contribution.id.length === 0) {
627
- console.error("'configuration.colors.id' must be defined and can not be empty");
631
+ this.logger.error("'configuration.colors.id' must be defined and can not be empty");
628
632
  continue;
629
633
  }
630
634
  if (!contribution.id.match(colorIdPattern)) {
631
- console.error("'configuration.colors.id' must follow the word[.word]*");
635
+ this.logger.error("'configuration.colors.id' must follow the word[.word]*");
632
636
  continue;
633
637
  }
634
638
  if (typeof contribution.description !== 'string' || contribution.id.length === 0) {
635
- console.error("'configuration.colors.description' must be defined and can not be empty");
639
+ this.logger.error("'configuration.colors.description' must be defined and can not be empty");
636
640
  continue;
637
641
  }
638
642
  const defaults = contribution.defaults;
639
643
  if (!defaults || typeof defaults !== 'object' || typeof defaults.light !== 'string' || typeof defaults.dark !== 'string' || typeof defaults.highContrast !== 'string') {
640
- console.error("'configuration.colors.defaults' must be defined and must contain 'light', 'dark' and 'highContrast'");
644
+ this.logger.error("'configuration.colors.defaults' must be defined and must contain 'light', 'dark' and 'highContrast'");
641
645
  continue;
642
646
  }
643
647
  result.push({
@@ -679,11 +683,11 @@ export class TheiaPluginScanner extends AbstractPluginScanner {
679
683
  const result: IconThemeContribution[] = [];
680
684
  for (const contribution of pck.contributes.iconThemes) {
681
685
  if (typeof contribution.id !== 'string') {
682
- console.error('Expected string in `contributes.iconThemes.id`. Provided value:', contribution.id);
686
+ this.logger.error('Expected string in `contributes.iconThemes.id`. Provided value:', contribution.id);
683
687
  continue;
684
688
  }
685
689
  if (typeof contribution.path !== 'string') {
686
- console.error('Expected string in `contributes.iconThemes.path`. Provided value:', contribution.path);
690
+ this.logger.error('Expected string in `contributes.iconThemes.path`. Provided value:', contribution.path);
687
691
  continue;
688
692
  }
689
693
  result.push({
@@ -706,13 +710,13 @@ export class TheiaPluginScanner extends AbstractPluginScanner {
706
710
  for (const id in iconEntries) {
707
711
  if (pck.contributes.icons.hasOwnProperty(id)) {
708
712
  if (!id.match(iconIdPattern)) {
709
- console.error("'configuration.icons' keys represent the icon id and can only contain letter, digits and minuses. " +
713
+ this.logger.error("'configuration.icons' keys represent the icon id and can only contain letter, digits and minuses. " +
710
714
  'They need to consist of at least two segments in the form `component-iconname`.', 'extension: ', pck.name, 'icon id: ', id);
711
715
  return;
712
716
  }
713
717
  const iconContribution = iconEntries[id];
714
718
  if (typeof iconContribution.description !== 'string' || iconContribution.description['length'] === 0) {
715
- console.error('configuration.icons.description must be defined and can not be empty, ', 'extension: ', pck.name, 'icon id: ', id);
719
+ this.logger.error('configuration.icons.description must be defined and can not be empty, ', 'extension: ', pck.name, 'icon id: ', id);
716
720
  return;
717
721
  }
718
722
 
@@ -727,7 +731,7 @@ export class TheiaPluginScanner extends AbstractPluginScanner {
727
731
  } else if (typeof defaultIcon === 'object' && typeof defaultIcon.fontPath === 'string' && typeof defaultIcon.fontCharacter === 'string') {
728
732
  const format = getFileExtension(defaultIcon.fontPath);
729
733
  if (['woff', 'woff2', 'ttf'].indexOf(format) === -1) {
730
- console.warn("Expected `contributes.icons.default.fontPath` to have file extension 'woff', woff2' or 'ttf', is '{0}'.", format);
734
+ this.logger.warn("Expected `contributes.icons.default.fontPath` to have file extension 'woff', woff2' or 'ttf', is '{0}'.", format);
731
735
  return;
732
736
  }
733
737
 
@@ -742,7 +746,7 @@ export class TheiaPluginScanner extends AbstractPluginScanner {
742
746
  }
743
747
  });
744
748
  } else {
745
- console.error("'configuration.icons.default' must be either a reference to the id of an other theme icon (string) or a icon definition (object) with ",
749
+ this.logger.error("'configuration.icons.default' must be either a reference to the id of an other theme icon (string) or a icon definition (object) with ",
746
750
  'properties `fontPath` and `fontCharacter`.');
747
751
  }
748
752
  }
@@ -777,7 +781,7 @@ export class TheiaPluginScanner extends AbstractPluginScanner {
777
781
  return content;
778
782
  } catch (e) {
779
783
  if (!isENOENT(e)) {
780
- console.error(e);
784
+ this.logger.error(e);
781
785
  }
782
786
  return '';
783
787
  }
@@ -1018,7 +1022,7 @@ export class TheiaPluginScanner extends AbstractPluginScanner {
1018
1022
  return undefined;
1019
1023
  }
1020
1024
  if (!Array.isArray(source)) {
1021
- console.warn(`[${langId}]: language configuration: expected \`autoClosingPairs\` to be an array.`);
1025
+ this.logger.warn(`[${langId}]: language configuration: expected \`autoClosingPairs\` to be an array.`);
1022
1026
  return undefined;
1023
1027
  }
1024
1028
 
@@ -1027,27 +1031,27 @@ export class TheiaPluginScanner extends AbstractPluginScanner {
1027
1031
  const pair = source[i];
1028
1032
  if (Array.isArray(pair)) {
1029
1033
  if (!isCharacterPair(pair)) {
1030
- console.warn(`[${langId}]: language configuration: expected \`autoClosingPairs[${i}]\` to be an array of two strings or an object.`);
1034
+ this.logger.warn(`[${langId}]: language configuration: expected \`autoClosingPairs[${i}]\` to be an array of two strings or an object.`);
1031
1035
  continue;
1032
1036
  }
1033
1037
  result = result || [];
1034
1038
  result.push({ open: pair[0], close: pair[1] });
1035
1039
  } else {
1036
1040
  if (!isObject(pair)) {
1037
- console.warn(`[${langId}]: language configuration: expected \`autoClosingPairs[${i}]\` to be an array of two strings or an object.`);
1041
+ this.logger.warn(`[${langId}]: language configuration: expected \`autoClosingPairs[${i}]\` to be an array of two strings or an object.`);
1038
1042
  continue;
1039
1043
  }
1040
1044
  if (typeof pair.open !== 'string') {
1041
- console.warn(`[${langId}]: language configuration: expected \`autoClosingPairs[${i}].open\` to be a string.`);
1045
+ this.logger.warn(`[${langId}]: language configuration: expected \`autoClosingPairs[${i}].open\` to be a string.`);
1042
1046
  continue;
1043
1047
  }
1044
1048
  if (typeof pair.close !== 'string') {
1045
- console.warn(`[${langId}]: language configuration: expected \`autoClosingPairs[${i}].close\` to be a string.`);
1049
+ this.logger.warn(`[${langId}]: language configuration: expected \`autoClosingPairs[${i}].close\` to be a string.`);
1046
1050
  continue;
1047
1051
  }
1048
1052
  if (typeof pair.notIn !== 'undefined') {
1049
1053
  if (!isStringArray(pair.notIn)) {
1050
- console.warn(`[${langId}]: language configuration: expected \`autoClosingPairs[${i}].notIn\` to be a string array.`);
1054
+ this.logger.warn(`[${langId}]: language configuration: expected \`autoClosingPairs[${i}].notIn\` to be a string array.`);
1051
1055
  continue;
1052
1056
  }
1053
1057
  }
@@ -1064,7 +1068,7 @@ export class TheiaPluginScanner extends AbstractPluginScanner {
1064
1068
  return undefined;
1065
1069
  }
1066
1070
  if (!Array.isArray(source)) {
1067
- console.warn(`[${langId}]: language configuration: expected \`surroundingPairs\` to be an array.`);
1071
+ this.logger.warn(`[${langId}]: language configuration: expected \`surroundingPairs\` to be an array.`);
1068
1072
  return undefined;
1069
1073
  }
1070
1074
 
@@ -1073,22 +1077,22 @@ export class TheiaPluginScanner extends AbstractPluginScanner {
1073
1077
  const pair = source[i];
1074
1078
  if (Array.isArray(pair)) {
1075
1079
  if (!isCharacterPair(pair)) {
1076
- console.warn(`[${langId}]: language configuration: expected \`surroundingPairs[${i}]\` to be an array of two strings or an object.`);
1080
+ this.logger.warn(`[${langId}]: language configuration: expected \`surroundingPairs[${i}]\` to be an array of two strings or an object.`);
1077
1081
  continue;
1078
1082
  }
1079
1083
  result = result || [];
1080
1084
  result.push({ open: pair[0], close: pair[1] });
1081
1085
  } else {
1082
1086
  if (!isObject(pair)) {
1083
- console.warn(`[${langId}]: language configuration: expected \`surroundingPairs[${i}]\` to be an array of two strings or an object.`);
1087
+ this.logger.warn(`[${langId}]: language configuration: expected \`surroundingPairs[${i}]\` to be an array of two strings or an object.`);
1084
1088
  continue;
1085
1089
  }
1086
1090
  if (typeof pair.open !== 'string') {
1087
- console.warn(`[${langId}]: language configuration: expected \`surroundingPairs[${i}].open\` to be a string.`);
1091
+ this.logger.warn(`[${langId}]: language configuration: expected \`surroundingPairs[${i}].open\` to be a string.`);
1088
1092
  continue;
1089
1093
  }
1090
1094
  if (typeof pair.close !== 'string') {
1091
- console.warn(`[${langId}]: language configuration: expected \`surroundingPairs[${i}].close\` to be a string.`);
1095
+ this.logger.warn(`[${langId}]: language configuration: expected \`surroundingPairs[${i}].close\` to be a string.`);
1092
1096
  continue;
1093
1097
  }
1094
1098
  result = result || [];
@@ -16,13 +16,13 @@
16
16
 
17
17
  import { DebuggerDescription, DebugPath, DebugService, DynamicDebugConfigurationProvider } from '@theia/debug/lib/common/debug-service';
18
18
  import debounce = require('@theia/core/shared/lodash.debounce');
19
- import { deepClone, Emitter, Event, nls } from '@theia/core';
19
+ import { deepClone, Emitter, Event, nls, ILogger } from '@theia/core';
20
20
  import { Disposable, DisposableCollection } from '@theia/core/lib/common/disposable';
21
21
  import { DebugConfiguration } from '@theia/debug/lib/common/debug-configuration';
22
22
  import { IJSONSchema, IJSONSchemaSnippet } from '@theia/core/lib/common/json-schema';
23
23
  import { PluginDebugAdapterContribution } from './plugin-debug-adapter-contribution';
24
24
  import { PluginDebugConfigurationProvider } from './plugin-debug-configuration-provider';
25
- import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
25
+ import { injectable, inject, postConstruct, named } from '@theia/core/shared/inversify';
26
26
  import { WebSocketConnectionProvider } from '@theia/core/lib/browser/messaging/ws-connection-provider';
27
27
  import { WorkspaceService } from '@theia/workspace/lib/browser';
28
28
  import { CommandIdVariables } from '@theia/variable-resolver/lib/common/variable-types';
@@ -64,6 +64,8 @@ export class PluginDebugService implements DebugService {
64
64
  protected readonly connectionProvider: WebSocketConnectionProvider;
65
65
  @inject(WorkspaceService)
66
66
  protected readonly workspaceService: WorkspaceService;
67
+ @inject(ILogger) @named('plugin-ext:PluginDebugService')
68
+ protected readonly logger: ILogger;
67
69
 
68
70
  @postConstruct()
69
71
  protected init(): void {
@@ -84,7 +86,7 @@ export class PluginDebugService implements DebugService {
84
86
  const { type } = contrib;
85
87
 
86
88
  if (this.contributors.has(type)) {
87
- console.warn(`Debugger with type '${type}' already registered.`);
89
+ this.logger.warn(`Debugger with type '${type}' already registered.`);
88
90
  return Disposable.NULL;
89
91
  }
90
92
 
@@ -105,7 +107,7 @@ export class PluginDebugService implements DebugService {
105
107
  if (this.configurationProviders.has(provider.handle)) {
106
108
  const configuration = this.configurationProviders.get(provider.handle);
107
109
  if (configuration && configuration.type !== provider.type) {
108
- console.warn(`Different debug configuration provider with type '${configuration.type}' already registered.`);
110
+ this.logger.warn(`Different debug configuration provider with type '${configuration.type}' already registered.`);
109
111
  provider.handle = this.configurationProviders.size;
110
112
  }
111
113
  }
@@ -358,7 +360,7 @@ export class PluginDebugService implements DebugService {
358
360
  }
359
361
  resolved = await resolver(workspaceFolderUri, resolved);
360
362
  } catch (e) {
361
- console.error(e);
363
+ this.logger.error(e);
362
364
  }
363
365
  }
364
366
  return resolved;
@@ -39,7 +39,7 @@ import {
39
39
  IdentifiableInlineCompletions,
40
40
  HoverWithId
41
41
  } from '../../common/plugin-api-rpc';
42
- import { injectable, inject } from '@theia/core/shared/inversify';
42
+ import { injectable, inject, named } from '@theia/core/shared/inversify';
43
43
  import {
44
44
  SerializedDocumentFilter, MarkerData, Range, RelatedInformation,
45
45
  MarkerSeverity, DocumentLink, WorkspaceSymbolParams, CodeAction, CompletionDto,
@@ -86,6 +86,7 @@ import { ITextModel } from '@theia/monaco-editor-core/esm/vs/editor/common/model
86
86
  import { CodeActionTriggerKind } from '../../plugin/types-impl';
87
87
  import { IReadonlyVSDataTransfer } from '@theia/monaco-editor-core/esm/vs/base/common/dataTransfer';
88
88
  import { FileUploadService } from '@theia/filesystem/lib/common/upload/file-upload';
89
+ import { ILogger } from '@theia/core';
89
90
 
90
91
  @injectable()
91
92
  export class LanguagesMainImpl implements LanguagesMain, Disposable {
@@ -108,6 +109,9 @@ export class LanguagesMainImpl implements LanguagesMain, Disposable {
108
109
  @inject(FileUploadService)
109
110
  protected readonly fileUploadService: FileUploadService;
110
111
 
112
+ @inject(ILogger) @named('plugin-ext:LanguagesMainImpl')
113
+ protected readonly logger: ILogger;
114
+
111
115
  private readonly proxy: LanguagesExt;
112
116
  private readonly services = new Map<number, Disposable>();
113
117
  private readonly toDispose = new DisposableCollection();
@@ -958,7 +962,7 @@ export class LanguagesMainImpl implements LanguagesMain, Disposable {
958
962
  dispose: () => this.proxy.$releaseCodeActions(handle, actions.map(a => a.cacheId))
959
963
  };
960
964
  } catch (e) {
961
- console.error(e);
965
+ this.logger.error(e);
962
966
  return undefined;
963
967
  }
964
968
  }
@@ -52,6 +52,7 @@ import { ContextKeyService } from '@theia/core/lib/browser/context-key-service';
52
52
  import { LanguageService } from '@theia/core/lib/browser/language-service';
53
53
  import { ThemeIcon } from '@theia/monaco-editor-core/esm/vs/base/common/themables';
54
54
  import { JSONObject, JSONValue } from '@theia/core/shared/@lumino/coreutils';
55
+ import { ILogger } from '@theia/core';
55
56
 
56
57
  // The enum export is missing from `vscode-textmate@9.2.0`
57
58
  const enum StandardTokenType {
@@ -147,6 +148,9 @@ export class PluginContributionHandler {
147
148
  @inject(ContextKeyService)
148
149
  protected readonly contextKeyService: ContextKeyService;
149
150
 
151
+ @inject(ILogger) @named('plugin-ext:PluginContributionHandler')
152
+ protected readonly logger: ILogger;
153
+
150
154
  protected readonly commandHandlers = new Map<string, CommandHandler['execute'] | undefined>();
151
155
 
152
156
  protected readonly onDidRegisterCommandHandlerEmitter = new Emitter<string>();
@@ -164,8 +168,8 @@ export class PluginContributionHandler {
164
168
  }
165
169
  const toDispose = new DisposableCollection(Disposable.create(() => { /* mark as not disposed */ }));
166
170
  /* eslint-disable @typescript-eslint/no-explicit-any */
167
- const logError = (message: string, ...args: any[]) => console.error(`[${clientId}][${plugin.metadata.model.id}]: ${message}`, ...args);
168
- const logWarning = (message: string, ...args: any[]) => console.warn(`[${clientId}][${plugin.metadata.model.id}]: ${message}`, ...args);
171
+ const logError = (message: string, ...args: any[]) => this.logger.error(`[${clientId}][${plugin.metadata.model.id}]: ${message}`, ...args);
172
+ const logWarning = (message: string, ...args: any[]) => this.logger.warn(`[${clientId}][${plugin.metadata.model.id}]: ${message}`, ...args);
169
173
  const pushContribution = (id: string, contribute: () => Disposable) => {
170
174
  if (toDispose.disposed) {
171
175
  return;
@@ -517,7 +521,7 @@ export class PluginContributionHandler {
517
521
 
518
522
  registerCommand(command: Command, enablement?: string): Disposable {
519
523
  if (this.hasCommand(command.id)) {
520
- console.warn(`command '${command.id}' already registered`);
524
+ this.logger.warn(`command '${command.id}' already registered`);
521
525
  return Disposable.NULL;
522
526
  }
523
527
 
@@ -565,7 +569,7 @@ export class PluginContributionHandler {
565
569
 
566
570
  registerCommandHandler(id: string, execute: CommandHandler['execute']): Disposable {
567
571
  if (this.hasCommandHandler(id)) {
568
- console.warn(`command handler '${id}' already registered`);
572
+ this.logger.warn(`command handler '${id}' already registered`);
569
573
  return Disposable.NULL;
570
574
  }
571
575
 
@@ -14,9 +14,10 @@
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 { Deferred } from '@theia/core/lib/common/promise-util';
19
19
  import { MaybePromise } from '@theia/core/lib/common/types';
20
+ import { ILogger } from '@theia/core';
20
21
 
21
22
  export interface WebviewResourceResponse {
22
23
  eTag: string | undefined,
@@ -29,6 +30,9 @@ export interface WebviewResourceResponse {
29
30
  @injectable()
30
31
  export class WebviewResourceCache {
31
32
 
33
+ @inject(ILogger) @named('plugin-ext:WebviewResourceCache')
34
+ protected readonly logger: ILogger;
35
+
32
36
  protected readonly cache = new Deferred<Cache | undefined>();
33
37
 
34
38
  constructor() {
@@ -39,7 +43,7 @@ export class WebviewResourceCache {
39
43
  try {
40
44
  this.cache.resolve(await caches.open('webview:v1'));
41
45
  } catch (e) {
42
- console.error('Failed to enable webview caching: ', e);
46
+ this.logger.error('Failed to enable webview caching: ', e);
43
47
  this.cache.resolve(undefined);
44
48
  }
45
49
  }
@@ -22,7 +22,7 @@
22
22
 
23
23
  import * as mime from 'mime';
24
24
  import { JSONExt } from '@theia/core/shared/@lumino/coreutils';
25
- import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
25
+ import { injectable, inject, postConstruct, named } from '@theia/core/shared/inversify';
26
26
  import { WebviewPanelOptions, WebviewPortMapping } from '@theia/plugin';
27
27
  import { BaseWidget, Message, codicon } from '@theia/core/lib/browser/widgets/widget';
28
28
  import { Disposable, DisposableCollection } from '@theia/core/lib/common/disposable';
@@ -49,7 +49,7 @@ import { FileService } from '@theia/filesystem/lib/browser/file-service';
49
49
  import { FileOperationError, FileOperationResult } from '@theia/filesystem/lib/common/files';
50
50
  import { BinaryBufferReadableStream } from '@theia/core/lib/common/buffer';
51
51
  import { ExtractableWidget } from '@theia/core/lib/browser/widgets/extractable-widget';
52
- import { MenuPath } from '@theia/core';
52
+ import { MenuPath, ILogger } from '@theia/core';
53
53
  import { ContextMenuRenderer } from '@theia/core/lib/browser';
54
54
  import { ContextKeyService } from '@theia/core/lib/browser/context-key-service';
55
55
  import { PluginViewWidget } from '../view/plugin-view-widget';
@@ -166,6 +166,9 @@ export class WebviewWidget extends BaseWidget implements StatefulWidget, Extract
166
166
  @inject(ContextKeyService)
167
167
  protected readonly contextKeyService: ContextKeyService;
168
168
 
169
+ @inject(ILogger) @named('plugin-ext:WebviewWidget')
170
+ protected readonly logger: ILogger;
171
+
169
172
  viewState: WebviewPanelViewState = {
170
173
  visible: false,
171
174
  active: false,
@@ -626,7 +629,7 @@ export class WebviewWidget extends BaseWidget implements StatefulWidget, Extract
626
629
  await this.ready.promise;
627
630
  this.postMessage(channel, data);
628
631
  } catch (e) {
629
- console.error(e);
632
+ this.logger.error(e);
630
633
  }
631
634
  }
632
635
 
@@ -42,7 +42,7 @@ export class PluginDeployerImpl implements PluginDeployer {
42
42
  protected readonly onDidDeployEmitter = new Emitter<void>();
43
43
  readonly onDidDeploy = this.onDidDeployEmitter.event;
44
44
 
45
- @inject(ILogger)
45
+ @inject(ILogger) @named('plugin-ext:PluginDeployerImpl')
46
46
  protected readonly logger: ILogger;
47
47
 
48
48
  @inject(PluginDeployerHandler)
@@ -215,7 +215,7 @@ export class PluginDeployerImpl implements PluginDeployer {
215
215
  }
216
216
  }
217
217
  } catch (e) {
218
- console.error(`Failed to resolve plugins from '${entry.id}'`, e);
218
+ this.logger.error(`Failed to resolve plugins from '${entry.id}'`, e);
219
219
  errors.push(e instanceof Error ? e : new Error(String(e)));
220
220
  }
221
221
  }));