@theia/plugin-ext 1.58.3 → 1.59.0-next.72

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 (90) 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/languages-main.d.ts.map +1 -1
  19. package/lib/main/browser/languages-main.js +4 -1
  20. package/lib/main/browser/languages-main.js.map +1 -1
  21. package/lib/main/browser/logger-main.d.ts +8 -0
  22. package/lib/main/browser/logger-main.d.ts.map +1 -0
  23. package/lib/main/browser/logger-main.js +53 -0
  24. package/lib/main/browser/logger-main.js.map +1 -0
  25. package/lib/main/browser/main-context.d.ts.map +1 -1
  26. package/lib/main/browser/main-context.js +3 -0
  27. package/lib/main/browser/main-context.js.map +1 -1
  28. package/lib/main/browser/plugin-contribution-handler.d.ts.map +1 -1
  29. package/lib/main/browser/plugin-contribution-handler.js.map +1 -1
  30. package/lib/plugin/debug/debug-ext.d.ts +1 -0
  31. package/lib/plugin/debug/debug-ext.d.ts.map +1 -1
  32. package/lib/plugin/debug/debug-ext.js +4 -2
  33. package/lib/plugin/debug/debug-ext.js.map +1 -1
  34. package/lib/plugin/decorations.d.ts +1 -0
  35. package/lib/plugin/decorations.d.ts.map +1 -1
  36. package/lib/plugin/decorations.js +4 -2
  37. package/lib/plugin/decorations.js.map +1 -1
  38. package/lib/plugin/localization-ext.d.ts +1 -0
  39. package/lib/plugin/localization-ext.d.ts.map +1 -1
  40. package/lib/plugin/localization-ext.js +3 -1
  41. package/lib/plugin/localization-ext.js.map +1 -1
  42. package/lib/plugin/logger.d.ts +16 -0
  43. package/lib/plugin/logger.d.ts.map +1 -0
  44. package/lib/plugin/logger.js +56 -0
  45. package/lib/plugin/logger.js.map +1 -0
  46. package/lib/plugin/notebook/notebook-document.js +1 -1
  47. package/lib/plugin/notebook/notebook-document.js.map +1 -1
  48. package/lib/plugin/notebook/notebook-kernels.d.ts +1 -0
  49. package/lib/plugin/notebook/notebook-kernels.d.ts.map +1 -1
  50. package/lib/plugin/notebook/notebook-kernels.js +19 -10
  51. package/lib/plugin/notebook/notebook-kernels.js.map +1 -1
  52. package/lib/plugin/notebook/notebooks.d.ts +4 -3
  53. package/lib/plugin/notebook/notebooks.d.ts.map +1 -1
  54. package/lib/plugin/notebook/notebooks.js +4 -2
  55. package/lib/plugin/notebook/notebooks.js.map +1 -1
  56. package/lib/plugin/plugin-context.d.ts.map +1 -1
  57. package/lib/plugin/plugin-context.js +5 -3
  58. package/lib/plugin/plugin-context.js.map +1 -1
  59. package/lib/plugin/plugin-manager.d.ts +1 -0
  60. package/lib/plugin/plugin-manager.d.ts.map +1 -1
  61. package/lib/plugin/plugin-manager.js +12 -10
  62. package/lib/plugin/plugin-manager.js.map +1 -1
  63. package/lib/plugin/uri-ext.d.ts.map +1 -1
  64. package/lib/plugin/uri-ext.js +0 -1
  65. package/lib/plugin/uri-ext.js.map +1 -1
  66. package/lib/plugin/workspace.d.ts +1 -0
  67. package/lib/plugin/workspace.d.ts.map +1 -1
  68. package/lib/plugin/workspace.js +6 -4
  69. package/lib/plugin/workspace.js.map +1 -1
  70. package/package.json +30 -30
  71. package/src/common/plugin-api-rpc.ts +23 -10
  72. package/src/hosted/node/hosted-plugin-process.ts +1 -2
  73. package/src/hosted/node/plugin-host-logger.ts +39 -0
  74. package/src/hosted/node/plugin-host-module.ts +5 -1
  75. package/src/main/browser/debug/plugin-debug-service.ts +5 -0
  76. package/src/main/browser/languages-main.ts +5 -1
  77. package/src/main/browser/logger-main.ts +53 -0
  78. package/src/main/browser/main-context.ts +4 -0
  79. package/src/main/browser/plugin-contribution-handler.ts +8 -1
  80. package/src/plugin/debug/debug-ext.ts +5 -2
  81. package/src/plugin/decorations.ts +5 -2
  82. package/src/plugin/localization-ext.ts +4 -1
  83. package/src/plugin/logger.ts +66 -0
  84. package/src/plugin/notebook/notebook-document.ts +1 -1
  85. package/src/plugin/notebook/notebook-kernels.ts +23 -11
  86. package/src/plugin/notebook/notebooks.ts +8 -5
  87. package/src/plugin/plugin-context.ts +6 -3
  88. package/src/plugin/plugin-manager.ts +15 -10
  89. package/src/plugin/uri-ext.ts +0 -1
  90. package/src/plugin/workspace.ts +7 -4
package/package.json CHANGED
@@ -1,37 +1,37 @@
1
1
  {
2
2
  "name": "@theia/plugin-ext",
3
- "version": "1.58.3",
3
+ "version": "1.59.0-next.72+f41d8efcd",
4
4
  "description": "Theia - Plugin Extension",
5
5
  "main": "lib/common/index.js",
6
6
  "typings": "lib/common/index.d.ts",
7
7
  "dependencies": {
8
- "@theia/bulk-edit": "1.58.3",
9
- "@theia/callhierarchy": "1.58.3",
10
- "@theia/console": "1.58.3",
11
- "@theia/core": "1.58.3",
12
- "@theia/debug": "1.58.3",
13
- "@theia/editor": "1.58.3",
14
- "@theia/editor-preview": "1.58.3",
15
- "@theia/file-search": "1.58.3",
16
- "@theia/filesystem": "1.58.3",
17
- "@theia/markers": "1.58.3",
18
- "@theia/messages": "1.58.3",
19
- "@theia/monaco": "1.58.3",
8
+ "@theia/bulk-edit": "1.59.0-next.72+f41d8efcd",
9
+ "@theia/callhierarchy": "1.59.0-next.72+f41d8efcd",
10
+ "@theia/console": "1.59.0-next.72+f41d8efcd",
11
+ "@theia/core": "1.59.0-next.72+f41d8efcd",
12
+ "@theia/debug": "1.59.0-next.72+f41d8efcd",
13
+ "@theia/editor": "1.59.0-next.72+f41d8efcd",
14
+ "@theia/editor-preview": "1.59.0-next.72+f41d8efcd",
15
+ "@theia/file-search": "1.59.0-next.72+f41d8efcd",
16
+ "@theia/filesystem": "1.59.0-next.72+f41d8efcd",
17
+ "@theia/markers": "1.59.0-next.72+f41d8efcd",
18
+ "@theia/messages": "1.59.0-next.72+f41d8efcd",
19
+ "@theia/monaco": "1.59.0-next.72+f41d8efcd",
20
20
  "@theia/monaco-editor-core": "1.96.302",
21
- "@theia/navigator": "1.58.3",
22
- "@theia/notebook": "1.58.3",
23
- "@theia/output": "1.58.3",
24
- "@theia/plugin": "1.58.3",
25
- "@theia/preferences": "1.58.3",
26
- "@theia/scm": "1.58.3",
27
- "@theia/search-in-workspace": "1.58.3",
28
- "@theia/task": "1.58.3",
29
- "@theia/terminal": "1.58.3",
30
- "@theia/test": "1.58.3",
31
- "@theia/timeline": "1.58.3",
32
- "@theia/typehierarchy": "1.58.3",
33
- "@theia/variable-resolver": "1.58.3",
34
- "@theia/workspace": "1.58.3",
21
+ "@theia/navigator": "1.59.0-next.72+f41d8efcd",
22
+ "@theia/notebook": "1.59.0-next.72+f41d8efcd",
23
+ "@theia/output": "1.59.0-next.72+f41d8efcd",
24
+ "@theia/plugin": "1.59.0-next.72+f41d8efcd",
25
+ "@theia/preferences": "1.59.0-next.72+f41d8efcd",
26
+ "@theia/scm": "1.59.0-next.72+f41d8efcd",
27
+ "@theia/search-in-workspace": "1.59.0-next.72+f41d8efcd",
28
+ "@theia/task": "1.59.0-next.72+f41d8efcd",
29
+ "@theia/terminal": "1.59.0-next.72+f41d8efcd",
30
+ "@theia/test": "1.59.0-next.72+f41d8efcd",
31
+ "@theia/timeline": "1.59.0-next.72+f41d8efcd",
32
+ "@theia/typehierarchy": "1.59.0-next.72+f41d8efcd",
33
+ "@theia/variable-resolver": "1.59.0-next.72+f41d8efcd",
34
+ "@theia/workspace": "1.59.0-next.72+f41d8efcd",
35
35
  "@types/mime": "^2.0.1",
36
36
  "@vscode/debugprotocol": "^1.51.0",
37
37
  "@vscode/proxy-agent": "^0.13.2",
@@ -49,7 +49,7 @@
49
49
  "semver": "^7.5.4",
50
50
  "tslib": "^2.6.2",
51
51
  "vhost": "^3.0.2",
52
- "vscode-textmate": "^9.0.0"
52
+ "vscode-textmate": "^9.2.0"
53
53
  },
54
54
  "publishConfig": {
55
55
  "access": "public"
@@ -89,7 +89,7 @@
89
89
  "watch": "theiaext watch"
90
90
  },
91
91
  "devDependencies": {
92
- "@theia/ext-scripts": "1.58.3",
92
+ "@theia/ext-scripts": "1.58.0",
93
93
  "@types/decompress": "^4.2.2",
94
94
  "@types/escape-html": "^0.0.20",
95
95
  "@types/lodash.clonedeep": "^4.5.3",
@@ -98,5 +98,5 @@
98
98
  "nyc": {
99
99
  "extends": "../../configs/nyc.json"
100
100
  },
101
- "gitHead": "ca70c15332f91e0f61b12cd147b5ff8326e2e6d2"
101
+ "gitHead": "f41d8efcd4abb79167b74bf476eafc7857e97306"
102
102
  }
@@ -2296,8 +2296,9 @@ export interface TestingMain {
2296
2296
  }
2297
2297
 
2298
2298
  export const PLUGIN_RPC_CONTEXT = {
2299
- AUTHENTICATION_MAIN: <ProxyIdentifier<AuthenticationMain>>createProxyIdentifier<AuthenticationMain>('AuthenticationMain'),
2300
- COMMAND_REGISTRY_MAIN: <ProxyIdentifier<CommandRegistryMain>>createProxyIdentifier<CommandRegistryMain>('CommandRegistryMain'),
2299
+ LOGGER_MAIN: createProxyIdentifier<LoggerMain>('LoggerMain'),
2300
+ AUTHENTICATION_MAIN: createProxyIdentifier<AuthenticationMain>('AuthenticationMain'),
2301
+ COMMAND_REGISTRY_MAIN: createProxyIdentifier<CommandRegistryMain>('CommandRegistryMain'),
2301
2302
  QUICK_OPEN_MAIN: createProxyIdentifier<QuickOpenMain>('QuickOpenMain'),
2302
2303
  DIALOGS_MAIN: createProxyIdentifier<DialogsMain>('DialogsMain'),
2303
2304
  WORKSPACE_MAIN: createProxyIdentifier<WorkspaceMain>('WorkspaceMain'),
@@ -2330,14 +2331,14 @@ export const PLUGIN_RPC_CONTEXT = {
2330
2331
  SECRETS_MAIN: createProxyIdentifier<SecretsMain>('SecretsMain'),
2331
2332
  DECORATIONS_MAIN: createProxyIdentifier<DecorationsMain>('DecorationsMain'),
2332
2333
  WINDOW_MAIN: createProxyIdentifier<WindowMain>('WindowMain'),
2333
- CLIPBOARD_MAIN: <ProxyIdentifier<ClipboardMain>>createProxyIdentifier<ClipboardMain>('ClipboardMain'),
2334
- LABEL_SERVICE_MAIN: <ProxyIdentifier<LabelServiceMain>>createProxyIdentifier<LabelServiceMain>('LabelServiceMain'),
2335
- TIMELINE_MAIN: <ProxyIdentifier<TimelineMain>>createProxyIdentifier<TimelineMain>('TimelineMain'),
2336
- THEMING_MAIN: <ProxyIdentifier<ThemingMain>>createProxyIdentifier<ThemingMain>('ThemingMain'),
2337
- COMMENTS_MAIN: <ProxyIdentifier<CommentsMain>>createProxyIdentifier<CommentsMain>('CommentsMain'),
2338
- TABS_MAIN: <ProxyIdentifier<TabsMain>>createProxyIdentifier<TabsMain>('TabsMain'),
2339
- TELEMETRY_MAIN: <ProxyIdentifier<TelemetryMain>>createProxyIdentifier<TelemetryMain>('TelemetryMain'),
2340
- LOCALIZATION_MAIN: <ProxyIdentifier<LocalizationMain>>createProxyIdentifier<LocalizationMain>('LocalizationMain'),
2334
+ CLIPBOARD_MAIN: createProxyIdentifier<ClipboardMain>('ClipboardMain'),
2335
+ LABEL_SERVICE_MAIN: createProxyIdentifier<LabelServiceMain>('LabelServiceMain'),
2336
+ TIMELINE_MAIN: createProxyIdentifier<TimelineMain>('TimelineMain'),
2337
+ THEMING_MAIN: createProxyIdentifier<ThemingMain>('ThemingMain'),
2338
+ COMMENTS_MAIN: createProxyIdentifier<CommentsMain>('CommentsMain'),
2339
+ TABS_MAIN: createProxyIdentifier<TabsMain>('TabsMain'),
2340
+ TELEMETRY_MAIN: createProxyIdentifier<TelemetryMain>('TelemetryMain'),
2341
+ LOCALIZATION_MAIN: createProxyIdentifier<LocalizationMain>('LocalizationMain'),
2341
2342
  TESTING_MAIN: createProxyIdentifier<TestingMain>('TestingMain'),
2342
2343
  URI_MAIN: createProxyIdentifier<UriMain>('UriMain')
2343
2344
  };
@@ -2759,3 +2760,15 @@ export interface StringDetails {
2759
2760
  export interface LocalizationMain {
2760
2761
  $fetchBundle(id: string): Promise<LanguagePackBundle | undefined>;
2761
2762
  }
2763
+
2764
+ export enum LogLevel {
2765
+ Trace = 1,
2766
+ Debug = 2,
2767
+ Info = 3,
2768
+ Warn = 4,
2769
+ Error = 5
2770
+ }
2771
+
2772
+ export interface LoggerMain {
2773
+ $log(level: LogLevel, name: string | undefined, message: string, params: any[]): void;
2774
+ }
@@ -192,8 +192,7 @@ export class HostedPluginProcess implements ServerPluginRunner {
192
192
  // 5th element MUST be 'overlapped' for it to work properly on Windows.
193
193
  // 'overlapped' works just like 'pipe' on non-Windows platforms.
194
194
  // See: https://nodejs.org/docs/latest-v14.x/api/child_process.html#child_process_options_stdio
195
- // Note: For some reason `@types/node` does not know about 'overlapped'.
196
- stdio: ['pipe', 'pipe', 'pipe', 'ipc', 'overlapped' as 'pipe']
195
+ stdio: ['pipe', 'pipe', 'pipe', 'ipc', 'overlapped']
197
196
  };
198
197
  const inspectArgPrefix = `--${options.serverName}-inspect`;
199
198
  const inspectArg = process.argv.find(v => v.startsWith(inspectArgPrefix));
@@ -0,0 +1,39 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2025 TypeFox and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { LogLevel } from '../../common/plugin-api-rpc';
18
+ import { RPCProtocol } from '../../common/rpc-protocol';
19
+ import { PluginLogger } from '../../plugin/logger';
20
+ import { format } from 'util';
21
+
22
+ export function setupPluginHostLogger(rpc: RPCProtocol): void {
23
+ const logger = new PluginLogger(rpc, 'plugin-host');
24
+
25
+ function createLog(level: LogLevel): typeof console.log {
26
+ return (message, ...params) => {
27
+ // Format the messages beforehand
28
+ // This ensures that we don't accidentally send objects that are not serializable
29
+ const formatted = format(message, ...params);
30
+ logger.log(level, formatted);
31
+ };
32
+ }
33
+
34
+ console.log = console.info = createLog(LogLevel.Info);
35
+ console.debug = createLog(LogLevel.Debug);
36
+ console.warn = createLog(LogLevel.Warn);
37
+ console.error = createLog(LogLevel.Error);
38
+ console.trace = createLog(LogLevel.Trace);
39
+ }
@@ -13,6 +13,7 @@
13
13
  //
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
+
16
17
  import '@theia/core/shared/reflect-metadata';
17
18
  import { ContainerModule } from '@theia/core/shared/inversify';
18
19
  import { RPCProtocol, RPCProtocolImpl } from '../../common/rpc-protocol';
@@ -34,10 +35,13 @@ import { KeyValueStorageProxy, InternalStorageExt } from '../../plugin/plugin-st
34
35
  import { WebviewsExtImpl } from '../../plugin/webviews';
35
36
  import { TerminalServiceExtImpl } from '../../plugin/terminal-ext';
36
37
  import { InternalSecretsExt, SecretsExtImpl } from '../../plugin/secrets-ext';
38
+ import { setupPluginHostLogger } from './plugin-host-logger';
37
39
 
38
40
  export default new ContainerModule(bind => {
39
41
  const channel = new IPCChannel();
40
- bind(RPCProtocol).toConstantValue(new RPCProtocolImpl(channel));
42
+ const rpc = new RPCProtocolImpl(channel);
43
+ setupPluginHostLogger(rpc);
44
+ bind(RPCProtocol).toConstantValue(rpc);
41
45
 
42
46
  bind(PluginContainerModuleLoader).toDynamicValue(({ container }) =>
43
47
  (module: ContainerModule) => {
@@ -360,6 +360,11 @@ export class PluginDebugService implements DebugService {
360
360
  default: 'openOnFirstSessionStart',
361
361
  description: nls.localizeByDefault('Controls when the internal Debug Console should open.')
362
362
  };
363
+ properties['suppressMultipleSessionWarning'] = {
364
+ type: 'boolean',
365
+ description: nls.localizeByDefault('Disable the warning when trying to start the same debug configuration more than once.'),
366
+ default: true
367
+ };
363
368
 
364
369
  const osProperties = Object.assign({}, properties);
365
370
  properties['windows'] = {
@@ -940,7 +940,11 @@ export class LanguagesMainImpl implements LanguagesMain, Disposable {
940
940
  },
941
941
  resolveCodeAction: (codeAction, token) => this.resolveCodeAction(handle, codeAction, token)
942
942
  };
943
- this.register(handle, (monaco.languages.registerCodeActionProvider as RegistrationFunction<monaco.languages.CodeActionProvider>)(languageSelector, quickFixProvider));
943
+ this.register(handle,
944
+ monaco.languages.registerCodeActionProvider(languageSelector, quickFixProvider, {
945
+ documentation: documentation,
946
+ providedCodeActionKinds
947
+ }));
944
948
  }
945
949
 
946
950
  protected async provideCodeActions(
@@ -0,0 +1,53 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2025 TypeFox and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ /* eslint-disable @typescript-eslint/no-explicit-any */
18
+
19
+ import { interfaces } from '@theia/core/shared/inversify';
20
+ import { LoggerMain, LogLevel } from '../../common';
21
+ import { ILogger } from '@theia/core';
22
+
23
+ export class LoggerMainImpl implements LoggerMain {
24
+
25
+ constructor(private readonly container: interfaces.Container) {
26
+ }
27
+
28
+ $log(level: LogLevel, name: string | undefined, message: string, params: any[]): void {
29
+ let logger: ILogger;
30
+ if (name) {
31
+ logger = this.container.getNamed<ILogger>(ILogger, name);
32
+ } else {
33
+ logger = this.container.get<ILogger>(ILogger);
34
+ }
35
+ switch (level) {
36
+ case LogLevel.Trace:
37
+ logger.trace(message, ...params);
38
+ break;
39
+ case LogLevel.Debug:
40
+ logger.debug(message, ...params);
41
+ break;
42
+ case LogLevel.Info:
43
+ logger.info(message, ...params);
44
+ break;
45
+ case LogLevel.Warn:
46
+ logger.warn(message, ...params);
47
+ break;
48
+ case LogLevel.Error:
49
+ logger.error(message, ...params);
50
+ break;
51
+ }
52
+ }
53
+ }
@@ -65,8 +65,12 @@ import { NotebookKernelsMainImpl } from './notebooks/notebook-kernels-main';
65
65
  import { NotebooksAndEditorsMain } from './notebooks/notebook-documents-and-editors-main';
66
66
  import { TestingMainImpl } from './test-main';
67
67
  import { UriMainImpl } from './uri-main';
68
+ import { LoggerMainImpl } from './logger-main';
68
69
 
69
70
  export function setUpPluginApi(rpc: RPCProtocol, container: interfaces.Container): void {
71
+ const loggerMain = new LoggerMainImpl(container);
72
+ rpc.set(PLUGIN_RPC_CONTEXT.LOGGER_MAIN, loggerMain);
73
+
70
74
  const authenticationMain = new AuthenticationMainImpl(rpc, container);
71
75
  rpc.set(PLUGIN_RPC_CONTEXT.AUTHENTICATION_MAIN, authenticationMain);
72
76
 
@@ -16,7 +16,6 @@
16
16
 
17
17
  import { injectable, inject, named } from '@theia/core/shared/inversify';
18
18
  import { ITokenTypeMap, IEmbeddedLanguagesMap } from 'vscode-textmate';
19
- import { StandardTokenType } from 'vscode-textmate/release/encodedTokenAttributes';
20
19
  import { TextmateRegistry, getEncodedLanguageId, MonacoTextmateService, GrammarDefinition } from '@theia/monaco/lib/browser/textmate';
21
20
  import { MenusContributionPointHandler } from './menus/menus-contribution-handler';
22
21
  import { PluginViewRegistry } from './view/plugin-view-registry';
@@ -55,6 +54,14 @@ import { ContextKeyService } from '@theia/core/lib/browser/context-key-service';
55
54
  import { LanguageService } from '@theia/core/lib/browser/language-service';
56
55
  import { ThemeIcon } from '@theia/monaco-editor-core/esm/vs/base/common/themables';
57
56
 
57
+ // The enum export is missing from `vscode-textmate@9.2.0`
58
+ const enum StandardTokenType {
59
+ Other = 0,
60
+ Comment = 1,
61
+ String = 2,
62
+ RegEx = 3
63
+ }
64
+
58
65
  @injectable()
59
66
  export class PluginContributionHandler {
60
67
 
@@ -35,6 +35,7 @@ import { NodeDebugAdapterCreator } from '../node/debug/plugin-node-debug-adapter
35
35
  import { DebugProtocol } from '@vscode/debugprotocol';
36
36
  import { DebugConfiguration, DebugSessionOptions } from '@theia/debug/lib/common/debug-configuration';
37
37
  import { checkTestRunInstance } from '../tests';
38
+ import { PluginLogger } from '../logger';
38
39
 
39
40
  interface ConfigurationProviderRecord {
40
41
  handle: number;
@@ -69,6 +70,7 @@ export class DebugExtImpl implements DebugExt {
69
70
  private commandRegistryExt: CommandRegistryImpl;
70
71
 
71
72
  private proxy: DebugMain;
73
+ private logger: PluginLogger;
72
74
 
73
75
  private readonly onDidChangeBreakpointsEmitter = new Emitter<theia.BreakpointsChangeEvent>();
74
76
  private readonly onDidChangeActiveDebugSessionEmitter = new Emitter<theia.DebugSession | undefined>();
@@ -104,6 +106,7 @@ export class DebugExtImpl implements DebugExt {
104
106
  @postConstruct()
105
107
  initialize(): void {
106
108
  this.proxy = this.rpc.getProxy(Ext.DEBUG_MAIN);
109
+ this.logger = new PluginLogger(this.rpc, 'debug');
107
110
  }
108
111
 
109
112
  /**
@@ -129,7 +132,7 @@ export class DebugExtImpl implements DebugExt {
129
132
  type: contribution.type,
130
133
  label: contribution.label || contribution.type
131
134
  });
132
- console.log(`Debugger contribution has been registered: ${contribution.type}`);
135
+ this.logger.debug(`Debugger contribution has been registered: ${contribution.type}`);
133
136
  });
134
137
  }
135
138
 
@@ -259,7 +262,7 @@ export class DebugExtImpl implements DebugExt {
259
262
  }
260
263
 
261
264
  registerDebugConfigurationProvider(debugType: string, provider: theia.DebugConfigurationProvider, trigger: DebugConfigurationProviderTriggerKind): Disposable {
262
- console.log(`Debug configuration provider has been registered: ${debugType}, trigger: ${trigger}`);
265
+ this.logger.info(`Debug configuration provider has been registered: ${debugType}, trigger: ${trigger}`);
263
266
 
264
267
  const handle = this.configurationProviderHandleGenerator++;
265
268
  this.configurationProviders.push({ handle, type: debugType, trigger, provider });
@@ -27,6 +27,7 @@ import { RPCProtocol } from '../common/rpc-protocol';
27
27
  import { Disposable, FileDecoration, URI } from './types-impl';
28
28
  import { CancellationToken } from '@theia/core/lib/common';
29
29
  import { dirname } from 'path';
30
+ import { PluginLogger } from './logger';
30
31
 
31
32
  /*---------------------------------------------------------------------------------------------
32
33
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -45,9 +46,11 @@ export class DecorationsExtImpl implements DecorationsExt {
45
46
 
46
47
  private readonly providersMap: Map<number, ProviderData>;
47
48
  private readonly proxy: DecorationsMain;
49
+ private readonly logger: PluginLogger;
48
50
 
49
51
  constructor(readonly rpc: RPCProtocol) {
50
52
  this.proxy = rpc.getProxy(PLUGIN_RPC_CONTEXT.DECORATIONS_MAIN);
53
+ this.logger = new PluginLogger(rpc, 'decorations-plugin');
51
54
  this.providersMap = new Map();
52
55
  }
53
56
 
@@ -128,10 +131,10 @@ export class DecorationsExtImpl implements DecorationsExt {
128
131
  FileDecoration.validate(data);
129
132
  result[id] = <DecorationData>[data.propagate, data.tooltip, data.badge, data.color];
130
133
  } catch (e) {
131
- console.warn(`INVALID decoration from extension '${pluginInfo.name}': ${e}`);
134
+ this.logger.warn(`INVALID decoration from extension '${pluginInfo.name}': ${e}`);
132
135
  }
133
136
  } catch (err) {
134
- console.error(err);
137
+ this.logger.error(err);
135
138
  }
136
139
  }));
137
140
 
@@ -23,6 +23,7 @@ import { LocalizationExt, LocalizationMain, Plugin, PLUGIN_RPC_CONTEXT, StringDe
23
23
  import { LanguagePackBundle } from '../common/language-pack-service';
24
24
  import { RPCProtocol } from '../common/rpc-protocol';
25
25
  import { URI } from './types-impl';
26
+ import { PluginLogger } from './logger';
26
27
 
27
28
  @injectable()
28
29
  export class LocalizationExtImpl implements LocalizationExt {
@@ -30,6 +31,7 @@ export class LocalizationExtImpl implements LocalizationExt {
30
31
  protected readonly rpc: RPCProtocol;
31
32
 
32
33
  private _proxy: LocalizationMain;
34
+ private logger: PluginLogger;
33
35
  private currentLanguage?: string;
34
36
  private isDefaultLanguage = true;
35
37
  private readonly bundleCache = new Map<string, LanguagePackBundle | undefined>();
@@ -37,6 +39,7 @@ export class LocalizationExtImpl implements LocalizationExt {
37
39
  @postConstruct()
38
40
  initialize(): void {
39
41
  this._proxy = this.rpc.getProxy(PLUGIN_RPC_CONTEXT.LOCALIZATION_MAIN);
42
+ this.logger = new PluginLogger(this.rpc, 'nls');
40
43
  }
41
44
 
42
45
  translateMessage(pluginId: string, details: StringDetails): string {
@@ -79,7 +82,7 @@ export class LocalizationExtImpl implements LocalizationExt {
79
82
  try {
80
83
  bundle = await this._proxy.$fetchBundle(plugin.model.id);
81
84
  } catch (e) {
82
- console.error(`Failed to load translations for ${plugin.model.id}: ${e.message}`);
85
+ this.logger.error(`Failed to load translations for ${plugin.model.id}: ${e.message}`);
83
86
  return;
84
87
  }
85
88
 
@@ -0,0 +1,66 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2025 TypeFox and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ /* eslint-disable @typescript-eslint/no-explicit-any */
18
+
19
+ import { LoggerMain, LogLevel, PLUGIN_RPC_CONTEXT } from '../common';
20
+ import { RPCProtocol } from '../common/rpc-protocol';
21
+
22
+ export class PluginLogger {
23
+
24
+ private readonly logger: LoggerMain;
25
+ private readonly name?: string;
26
+
27
+ constructor(rpc: RPCProtocol, name?: string) {
28
+ this.name = name;
29
+ this.logger = rpc.getProxy(PLUGIN_RPC_CONTEXT.LOGGER_MAIN);
30
+ }
31
+
32
+ trace(message: string, ...params: any[]): void {
33
+ this.sendLog(LogLevel.Trace, message, params);
34
+ }
35
+
36
+ debug(message: string, ...params: any[]): void {
37
+ this.sendLog(LogLevel.Debug, message, params);
38
+ }
39
+
40
+ log(logLevel: LogLevel, message: string, ...params: any[]): void {
41
+ this.sendLog(logLevel, message, params);
42
+ }
43
+
44
+ info(message: string, ...params: any[]): void {
45
+ this.sendLog(LogLevel.Info, message, params);
46
+ }
47
+
48
+ warn(message: string, ...params: any[]): void {
49
+ this.sendLog(LogLevel.Warn, message, params);
50
+ }
51
+
52
+ error(message: string, ...params: any[]): void {
53
+ this.sendLog(LogLevel.Error, message, params);
54
+ }
55
+
56
+ private sendLog(level: LogLevel, message: string, params: any[]): void {
57
+ this.logger.$log(level, this.name, this.toLog(message), params.map(e => this.toLog(e)));
58
+ }
59
+
60
+ private toLog(value: any): any {
61
+ if (value instanceof Error) {
62
+ return value.stack ?? value.message ?? value.toString();
63
+ }
64
+ return value;
65
+ }
66
+ }
@@ -57,7 +57,7 @@ export class Cell {
57
57
  uri: cell.uri,
58
58
  isDirty: false,
59
59
  versionId: 1,
60
- modeId: ''
60
+ modeId: cell.language
61
61
  };
62
62
  }
63
63