@theia/plugin-ext 1.18.0-next.ed824933 → 1.21.0-next.11
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.
- package/LICENSE +642 -0
- package/README.md +5 -0
- package/lib/common/arrays.d.ts +4 -0
- package/lib/common/arrays.d.ts.map +1 -1
- package/lib/common/arrays.js +9 -1
- package/lib/common/arrays.js.map +1 -1
- package/lib/common/connection.d.ts +47 -34
- package/lib/common/connection.d.ts.map +1 -1
- package/lib/common/connection.js +90 -28
- package/lib/common/connection.js.map +1 -1
- package/lib/common/plugin-api-rpc-model.d.ts +4 -0
- package/lib/common/plugin-api-rpc-model.d.ts.map +1 -1
- package/lib/common/plugin-api-rpc-model.js.map +1 -1
- package/lib/common/plugin-api-rpc.d.ts +30 -13
- package/lib/common/plugin-api-rpc.d.ts.map +1 -1
- package/lib/common/plugin-api-rpc.js +21 -1
- package/lib/common/plugin-api-rpc.js.map +1 -1
- package/lib/common/plugin-protocol.d.ts +3 -1
- package/lib/common/plugin-protocol.d.ts.map +1 -1
- package/lib/common/plugin-protocol.js.map +1 -1
- package/lib/hosted/browser/hosted-plugin.d.ts +5 -6
- package/lib/hosted/browser/hosted-plugin.d.ts.map +1 -1
- package/lib/hosted/browser/hosted-plugin.js +20 -14
- package/lib/hosted/browser/hosted-plugin.js.map +1 -1
- package/lib/hosted/browser/worker/debug-stub.d.ts.map +1 -1
- package/lib/hosted/browser/worker/debug-stub.js +1 -0
- package/lib/hosted/browser/worker/debug-stub.js.map +1 -1
- package/lib/hosted/node/hosted-plugin-deployer-handler.d.ts +1 -1
- package/lib/hosted/node/hosted-plugin-deployer-handler.d.ts.map +1 -1
- package/lib/hosted/node/hosted-plugin-deployer-handler.js +14 -38
- package/lib/hosted/node/hosted-plugin-deployer-handler.js.map +1 -1
- package/lib/hosted/node/hosted-plugin-localization-service.d.ts +37 -0
- package/lib/hosted/node/hosted-plugin-localization-service.d.ts.map +1 -0
- package/lib/hosted/node/hosted-plugin-localization-service.js +197 -0
- package/lib/hosted/node/hosted-plugin-localization-service.js.map +1 -0
- package/lib/hosted/node/hosted-plugin-process.d.ts +2 -2
- package/lib/hosted/node/hosted-plugin-process.d.ts.map +1 -1
- package/lib/hosted/node/hosted-plugin-process.js +5 -7
- package/lib/hosted/node/hosted-plugin-process.js.map +1 -1
- package/lib/hosted/node/plugin-ext-hosted-backend-module.d.ts.map +1 -1
- package/lib/hosted/node/plugin-ext-hosted-backend-module.js +2 -0
- package/lib/hosted/node/plugin-ext-hosted-backend-module.js.map +1 -1
- package/lib/hosted/node/plugin-manifest-loader.d.ts +1 -1
- package/lib/hosted/node/plugin-manifest-loader.d.ts.map +1 -1
- package/lib/hosted/node/plugin-manifest-loader.js +4 -52
- package/lib/hosted/node/plugin-manifest-loader.js.map +1 -1
- package/lib/hosted/node/plugin-service.d.ts +3 -6
- package/lib/hosted/node/plugin-service.d.ts.map +1 -1
- package/lib/hosted/node/plugin-service.js +7 -40
- package/lib/hosted/node/plugin-service.js.map +1 -1
- package/lib/hosted/node/scanners/scanner-theia.d.ts +1 -1
- package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
- package/lib/hosted/node/scanners/scanner-theia.js +6 -2
- package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
- package/lib/main/browser/callhierarchy/callhierarchy-type-converters.d.ts.map +1 -1
- package/lib/main/browser/callhierarchy/callhierarchy-type-converters.js +6 -2
- package/lib/main/browser/callhierarchy/callhierarchy-type-converters.js.map +1 -1
- package/lib/main/browser/custom-editors/custom-editor-opener.d.ts +2 -2
- package/lib/main/browser/custom-editors/custom-editor-opener.d.ts.map +1 -1
- package/lib/main/browser/custom-editors/custom-editor-opener.js +6 -2
- package/lib/main/browser/custom-editors/custom-editor-opener.js.map +1 -1
- package/lib/main/browser/custom-editors/custom-editors-main.d.ts.map +1 -1
- package/lib/main/browser/custom-editors/custom-editors-main.js +1 -2
- package/lib/main/browser/custom-editors/custom-editors-main.js.map +1 -1
- package/lib/main/browser/debug/debug-main.d.ts +3 -3
- package/lib/main/browser/debug/debug-main.d.ts.map +1 -1
- package/lib/main/browser/debug/debug-main.js +2 -3
- package/lib/main/browser/debug/debug-main.js.map +1 -1
- package/lib/main/browser/debug/plugin-debug-adapter-contribution.d.ts +1 -1
- package/lib/main/browser/debug/plugin-debug-adapter-contribution.d.ts.map +1 -1
- package/lib/main/browser/debug/plugin-debug-adapter-contribution.js +2 -2
- package/lib/main/browser/debug/plugin-debug-adapter-contribution.js.map +1 -1
- package/lib/main/browser/debug/plugin-debug-service.d.ts +8 -0
- package/lib/main/browser/debug/plugin-debug-service.d.ts.map +1 -1
- package/lib/main/browser/debug/plugin-debug-service.js +15 -0
- package/lib/main/browser/debug/plugin-debug-service.js.map +1 -1
- package/lib/main/browser/debug/plugin-debug-session-factory.d.ts +6 -6
- package/lib/main/browser/debug/plugin-debug-session-factory.d.ts.map +1 -1
- package/lib/main/browser/debug/plugin-debug-session-factory.js +1 -1
- package/lib/main/browser/debug/plugin-debug-session-factory.js.map +1 -1
- package/lib/main/browser/dialogs/modal-notification.d.ts +3 -3
- package/lib/main/browser/dialogs/modal-notification.d.ts.map +1 -1
- package/lib/main/browser/dialogs/modal-notification.js +17 -6
- package/lib/main/browser/dialogs/modal-notification.js.map +1 -1
- package/lib/main/browser/editors-and-documents-main.d.ts.map +1 -1
- package/lib/main/browser/editors-and-documents-main.js +3 -4
- package/lib/main/browser/editors-and-documents-main.js.map +1 -1
- package/lib/main/browser/file-system-main-impl.js +1 -1
- package/lib/main/browser/file-system-main-impl.js.map +1 -1
- package/lib/main/browser/languages-main.js +1 -1
- package/lib/main/browser/languages-main.js.map +1 -1
- package/lib/main/browser/main-context.js +2 -2
- package/lib/main/browser/main-context.js.map +1 -1
- package/lib/main/browser/message-registry-main.js +1 -1
- package/lib/main/browser/message-registry-main.js.map +1 -1
- package/lib/main/browser/plugin-ext-frontend-module.d.ts.map +1 -1
- package/lib/main/browser/plugin-ext-frontend-module.js +5 -3
- package/lib/main/browser/plugin-ext-frontend-module.js.map +1 -1
- package/lib/main/browser/quick-open-main.d.ts +3 -6
- package/lib/main/browser/quick-open-main.d.ts.map +1 -1
- package/lib/main/browser/quick-open-main.js +48 -100
- package/lib/main/browser/quick-open-main.js.map +1 -1
- package/lib/main/browser/tasks-main.d.ts.map +1 -1
- package/lib/main/browser/tasks-main.js +6 -0
- package/lib/main/browser/tasks-main.js.map +1 -1
- package/lib/main/browser/timeline-main.d.ts.map +1 -1
- package/lib/main/browser/timeline-main.js +1 -1
- package/lib/main/browser/timeline-main.js.map +1 -1
- package/lib/main/browser/view/plugin-view-registry.d.ts +3 -2
- package/lib/main/browser/view/plugin-view-registry.d.ts.map +1 -1
- package/lib/main/browser/view/plugin-view-registry.js +77 -26
- package/lib/main/browser/view/plugin-view-registry.js.map +1 -1
- package/lib/main/browser/view/plugin-view-widget.d.ts +2 -0
- package/lib/main/browser/view/plugin-view-widget.d.ts.map +1 -1
- package/lib/main/browser/view/plugin-view-widget.js +3 -1
- package/lib/main/browser/view/plugin-view-widget.js.map +1 -1
- package/lib/main/browser/view/tree-view-widget.d.ts +3 -7
- package/lib/main/browser/view/tree-view-widget.d.ts.map +1 -1
- package/lib/main/browser/view/tree-view-widget.js +26 -39
- package/lib/main/browser/view/tree-view-widget.js.map +1 -1
- package/lib/main/browser/webview/webview-frontend-security-warnings.d.ts.map +1 -1
- package/lib/main/browser/webview/webview-frontend-security-warnings.js +8 -5
- package/lib/main/browser/webview/webview-frontend-security-warnings.js.map +1 -1
- package/lib/main/browser/webview/webview-preferences.d.ts.map +1 -1
- package/lib/main/browser/webview/webview-preferences.js +3 -2
- package/lib/main/browser/webview/webview-preferences.js.map +1 -1
- package/lib/main/browser/webview/webview.d.ts +1 -1
- package/lib/main/browser/webview/webview.d.ts.map +1 -1
- package/lib/main/browser/webview/webview.js +2 -2
- package/lib/main/browser/webview/webview.js.map +1 -1
- package/lib/plugin/comments.d.ts.map +1 -1
- package/lib/plugin/comments.js +2 -3
- package/lib/plugin/comments.js.map +1 -1
- package/lib/plugin/custom-editors.d.ts +1 -2
- package/lib/plugin/custom-editors.d.ts.map +1 -1
- package/lib/plugin/custom-editors.js +2 -3
- package/lib/plugin/custom-editors.js.map +1 -1
- package/lib/plugin/decorations.d.ts.map +1 -1
- package/lib/plugin/decorations.js +2 -3
- package/lib/plugin/decorations.js.map +1 -1
- package/lib/plugin/document-data.d.ts.map +1 -1
- package/lib/plugin/document-data.js +1 -1
- package/lib/plugin/document-data.js.map +1 -1
- package/lib/plugin/documents.d.ts.map +1 -1
- package/lib/plugin/documents.js +1 -2
- package/lib/plugin/documents.js.map +1 -1
- package/lib/plugin/file-system-event-service-ext-impl.d.ts.map +1 -1
- package/lib/plugin/file-system-event-service-ext-impl.js +2 -3
- package/lib/plugin/file-system-event-service-ext-impl.js.map +1 -1
- package/lib/plugin/file-system-ext-impl.d.ts.map +1 -1
- package/lib/plugin/file-system-ext-impl.js +12 -13
- package/lib/plugin/file-system-ext-impl.js.map +1 -1
- package/lib/plugin/known-commands.spec.js +1 -2
- package/lib/plugin/known-commands.spec.js.map +1 -1
- package/lib/plugin/languages/call-hierarchy.d.ts +1 -1
- package/lib/plugin/languages/call-hierarchy.d.ts.map +1 -1
- package/lib/plugin/languages/call-hierarchy.js +8 -3
- package/lib/plugin/languages/call-hierarchy.js.map +1 -1
- package/lib/plugin/languages/rename.d.ts +1 -2
- package/lib/plugin/languages/rename.d.ts.map +1 -1
- package/lib/plugin/languages/rename.js.map +1 -1
- package/lib/plugin/languages.d.ts +1 -1
- package/lib/plugin/languages.d.ts.map +1 -1
- package/lib/plugin/languages.js +2 -1
- package/lib/plugin/languages.js.map +1 -1
- package/lib/plugin/message-registry.d.ts.map +1 -1
- package/lib/plugin/message-registry.js +3 -0
- package/lib/plugin/message-registry.js.map +1 -1
- package/lib/plugin/node/debug/debug.d.ts +7 -6
- package/lib/plugin/node/debug/debug.d.ts.map +1 -1
- package/lib/plugin/node/debug/debug.js +37 -19
- package/lib/plugin/node/debug/debug.js.map +1 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts +7 -7
- package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts.map +1 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-session.js +6 -6
- package/lib/plugin/node/debug/plugin-debug-adapter-session.js.map +1 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-starter.d.ts +8 -4
- package/lib/plugin/node/debug/plugin-debug-adapter-starter.d.ts.map +1 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-starter.js +16 -13
- package/lib/plugin/node/debug/plugin-debug-adapter-starter.js.map +1 -1
- package/lib/plugin/plugin-context.d.ts.map +1 -1
- package/lib/plugin/plugin-context.js +10 -5
- package/lib/plugin/plugin-context.js.map +1 -1
- package/lib/plugin/plugin-manager.d.ts +2 -0
- package/lib/plugin/plugin-manager.d.ts.map +1 -1
- package/lib/plugin/plugin-manager.js +24 -3
- package/lib/plugin/plugin-manager.js.map +1 -1
- package/lib/plugin/plugin-storage.d.ts +4 -0
- package/lib/plugin/plugin-storage.d.ts.map +1 -1
- package/lib/plugin/plugin-storage.js +6 -1
- package/lib/plugin/plugin-storage.js.map +1 -1
- package/lib/plugin/preference-registry.spec.js.map +1 -1
- package/lib/plugin/quick-open.d.ts +2 -4
- package/lib/plugin/quick-open.d.ts.map +1 -1
- package/lib/plugin/quick-open.js +12 -29
- package/lib/plugin/quick-open.js.map +1 -1
- package/lib/plugin/tasks/tasks.d.ts +1 -3
- package/lib/plugin/tasks/tasks.d.ts.map +1 -1
- package/lib/plugin/tasks/tasks.js +3 -17
- package/lib/plugin/tasks/tasks.js.map +1 -1
- package/lib/plugin/timeline.d.ts.map +1 -1
- package/lib/plugin/timeline.js +1 -2
- package/lib/plugin/timeline.js.map +1 -1
- package/lib/plugin/type-converters.d.ts.map +1 -1
- package/lib/plugin/type-converters.js +18 -11
- package/lib/plugin/type-converters.js.map +1 -1
- package/lib/plugin/types-impl.d.ts +55 -1
- package/lib/plugin/types-impl.d.ts.map +1 -1
- package/lib/plugin/types-impl.js +81 -1
- package/lib/plugin/types-impl.js.map +1 -1
- package/lib/plugin/webviews.d.ts +1 -2
- package/lib/plugin/webviews.d.ts.map +1 -1
- package/lib/plugin/webviews.js.map +1 -1
- package/package.json +31 -27
- package/src/common/arrays.ts +8 -0
- package/src/common/connection.ts +98 -42
- package/src/common/plugin-api-rpc-model.ts +4 -0
- package/src/common/plugin-api-rpc.ts +31 -12
- package/src/common/plugin-protocol.ts +3 -1
- package/src/hosted/browser/hosted-plugin.ts +20 -13
- package/src/hosted/browser/worker/debug-stub.ts +1 -0
- package/src/hosted/node/hosted-plugin-deployer-handler.ts +13 -40
- package/src/hosted/node/hosted-plugin-localization-service.ts +201 -0
- package/src/hosted/node/hosted-plugin-process.ts +4 -6
- package/src/hosted/node/plugin-ext-hosted-backend-module.ts +2 -0
- package/src/hosted/node/plugin-manifest-loader.ts +4 -56
- package/src/hosted/node/plugin-service.ts +7 -40
- package/src/hosted/node/scanners/scanner-theia.ts +7 -3
- package/src/main/browser/callhierarchy/callhierarchy-type-converters.ts +6 -2
- package/src/main/browser/custom-editors/custom-editor-opener.tsx +8 -4
- package/src/main/browser/custom-editors/custom-editors-main.ts +1 -2
- package/src/main/browser/debug/debug-main.ts +4 -5
- package/src/main/browser/debug/plugin-debug-adapter-contribution.ts +3 -3
- package/src/main/browser/debug/plugin-debug-service.ts +23 -0
- package/src/main/browser/debug/plugin-debug-session-factory.ts +6 -6
- package/src/main/browser/dialogs/modal-notification.ts +18 -7
- package/src/main/browser/dialogs/style/modal-notification.css +17 -2
- package/src/main/browser/editors-and-documents-main.ts +1 -2
- package/src/main/browser/file-system-main-impl.ts +1 -1
- package/src/main/browser/languages-main.ts +1 -1
- package/src/main/browser/main-context.ts +3 -3
- package/src/main/browser/message-registry-main.ts +1 -1
- package/src/main/browser/plugin-ext-frontend-module.ts +6 -4
- package/src/main/browser/quick-open-main.ts +54 -109
- package/src/main/browser/style/tree.css +4 -0
- package/src/main/browser/tasks-main.ts +7 -0
- package/src/main/browser/timeline-main.ts +1 -2
- package/src/main/browser/view/plugin-view-registry.ts +83 -28
- package/src/main/browser/view/plugin-view-widget.ts +7 -2
- package/src/main/browser/view/tree-view-widget.tsx +43 -65
- package/src/main/browser/webview/pre/host.js +20 -12
- package/src/main/browser/webview/pre/main.js +1 -2
- package/src/main/browser/webview/pre/service-worker.js +1 -1
- package/src/main/browser/webview/webview-frontend-security-warnings.ts +8 -7
- package/src/main/browser/webview/webview-preferences.ts +3 -2
- package/src/main/browser/webview/webview.ts +2 -2
- package/src/plugin/comments.ts +1 -2
- package/src/plugin/custom-editors.ts +2 -4
- package/src/plugin/decorations.ts +1 -2
- package/src/plugin/document-data.ts +1 -2
- package/src/plugin/documents.ts +1 -2
- package/src/plugin/file-system-event-service-ext-impl.ts +1 -2
- package/src/plugin/file-system-ext-impl.ts +1 -2
- package/src/plugin/known-commands.spec.ts +1 -2
- package/src/plugin/languages/call-hierarchy.ts +14 -5
- package/src/plugin/languages/rename.ts +1 -2
- package/src/plugin/languages.ts +5 -2
- package/src/plugin/message-registry.ts +3 -1
- package/src/plugin/node/debug/debug.ts +46 -26
- package/src/plugin/node/debug/plugin-debug-adapter-session.ts +9 -9
- package/src/plugin/node/debug/plugin-debug-adapter-starter.ts +17 -14
- package/src/plugin/plugin-context.ts +24 -12
- package/src/plugin/plugin-manager.ts +26 -4
- package/src/plugin/plugin-storage.ts +7 -2
- package/src/plugin/preference-registry.spec.ts +1 -2
- package/src/plugin/quick-open.ts +16 -36
- package/src/plugin/tasks/tasks.ts +4 -18
- package/src/plugin/timeline.ts +1 -2
- package/src/plugin/type-converters.ts +20 -13
- package/src/plugin/types-impl.ts +77 -1
- package/src/plugin/webviews.ts +1 -2
- package/lib/common/plugin-message-reader.d.ts +0 -46
- package/lib/common/plugin-message-reader.d.ts.map +0 -1
- package/lib/common/plugin-message-reader.js +0 -116
- package/lib/common/plugin-message-reader.js.map +0 -1
- package/lib/common/plugin-message-writer.d.ts +0 -38
- package/lib/common/plugin-message-writer.d.ts.map +0 -1
- package/lib/common/plugin-message-writer.js +0 -67
- package/lib/common/plugin-message-writer.js.map +0 -1
- package/lib/main/browser/connection-main.d.ts +0 -59
- package/lib/main/browser/connection-main.d.ts.map +0 -1
- package/lib/main/browser/connection-main.js +0 -98
- package/lib/main/browser/connection-main.js.map +0 -1
- package/lib/plugin/connection-ext.d.ts +0 -56
- package/lib/plugin/connection-ext.d.ts.map +0 -1
- package/lib/plugin/connection-ext.js +0 -88
- package/lib/plugin/connection-ext.js.map +0 -1
- package/src/common/plugin-message-reader.ts +0 -111
- package/src/common/plugin-message-writer.ts +0 -65
- package/src/main/browser/connection-main.ts +0 -107
- package/src/plugin/connection-ext.ts +0 -95
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
|
|
17
|
+
// eslint-disable-next-line @theia/runtime-import-check
|
|
17
18
|
import { DebugExtImpl } from '../../../plugin/node/debug/debug';
|
|
18
19
|
import { RPCProtocol } from '../../../common/rpc-protocol';
|
|
19
20
|
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
import * as fs from '@theia/core/shared/fs-extra';
|
|
18
18
|
import { injectable, inject } from '@theia/core/shared/inversify';
|
|
19
19
|
import { ILogger } from '@theia/core';
|
|
20
|
-
import { PluginDeployerHandler, PluginDeployerEntry, PluginEntryPoint, DeployedPlugin, PluginDependencies,
|
|
20
|
+
import { PluginDeployerHandler, PluginDeployerEntry, PluginEntryPoint, DeployedPlugin, PluginDependencies, PluginType } from '../../common/plugin-protocol';
|
|
21
21
|
import { HostedPluginReader } from './plugin-reader';
|
|
22
22
|
import { Deferred } from '@theia/core/lib/common/promise-util';
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
23
|
+
import { HostedPluginLocalizationService } from './hosted-plugin-localization-service';
|
|
24
|
+
import { BackendApplicationConfigProvider } from '@theia/core/lib/node/backend-application-config-provider';
|
|
25
25
|
|
|
26
26
|
@injectable()
|
|
27
27
|
export class HostedPluginDeployerHandler implements PluginDeployerHandler {
|
|
@@ -32,8 +32,8 @@ export class HostedPluginDeployerHandler implements PluginDeployerHandler {
|
|
|
32
32
|
@inject(HostedPluginReader)
|
|
33
33
|
private readonly reader: HostedPluginReader;
|
|
34
34
|
|
|
35
|
-
@inject(
|
|
36
|
-
private readonly
|
|
35
|
+
@inject(HostedPluginLocalizationService)
|
|
36
|
+
private readonly localizationService: HostedPluginLocalizationService;
|
|
37
37
|
|
|
38
38
|
private readonly deployedLocations = new Map<string, Set<string>>();
|
|
39
39
|
|
|
@@ -85,7 +85,11 @@ export class HostedPluginDeployerHandler implements PluginDeployerHandler {
|
|
|
85
85
|
}
|
|
86
86
|
const metadata = this.reader.readMetadata(manifest);
|
|
87
87
|
const dependencies: PluginDependencies = { metadata };
|
|
88
|
-
|
|
88
|
+
// Do not resolve system (aka builtin) plugins because it should be done statically at build time.
|
|
89
|
+
const { resolveSystemPlugins = true } = BackendApplicationConfigProvider.get();
|
|
90
|
+
if (resolveSystemPlugins || entry.type !== PluginType.System) {
|
|
91
|
+
dependencies.mapping = this.reader.readDependencies(manifest);
|
|
92
|
+
}
|
|
89
93
|
return dependencies;
|
|
90
94
|
} catch (e) {
|
|
91
95
|
console.error(`Failed to load plugin dependencies from '${pluginPath}' path`, e);
|
|
@@ -105,6 +109,8 @@ export class HostedPluginDeployerHandler implements PluginDeployerHandler {
|
|
|
105
109
|
for (const plugin of backendPlugins) {
|
|
106
110
|
await this.deployPlugin(plugin, 'backend');
|
|
107
111
|
}
|
|
112
|
+
// rebuild translation config after deployment
|
|
113
|
+
this.localizationService.buildTranslationConfig([...this.deployedBackendPlugins.values()]);
|
|
108
114
|
// resolve on first deploy
|
|
109
115
|
this.backendPluginsMetadataDeferred.resolve(undefined);
|
|
110
116
|
}
|
|
@@ -134,9 +140,7 @@ export class HostedPluginDeployerHandler implements PluginDeployerHandler {
|
|
|
134
140
|
const { type } = entry;
|
|
135
141
|
const deployed: DeployedPlugin = { metadata, type };
|
|
136
142
|
deployed.contributes = this.reader.readContribution(manifest);
|
|
137
|
-
|
|
138
|
-
this.localizationProvider.addLocalizations(...buildTheiaLocalizations(deployed.contributes.localizations));
|
|
139
|
-
}
|
|
143
|
+
this.localizationService.deployLocalizations(deployed);
|
|
140
144
|
deployedPlugins.set(metadata.model.id, deployed);
|
|
141
145
|
this.logger.info(`Deploying ${entryPoint} plugin "${metadata.model.name}@${metadata.model.version}" from "${metadata.model.entryPoint[entryPoint] || pluginPath}"`);
|
|
142
146
|
} catch (e) {
|
|
@@ -162,34 +166,3 @@ export class HostedPluginDeployerHandler implements PluginDeployerHandler {
|
|
|
162
166
|
return true;
|
|
163
167
|
}
|
|
164
168
|
}
|
|
165
|
-
|
|
166
|
-
function buildTheiaLocalizations(localizations: Localization[]): TheiaLocalization[] {
|
|
167
|
-
const theiaLocalizations: TheiaLocalization[] = [];
|
|
168
|
-
for (const localization of localizations) {
|
|
169
|
-
const theiaLocalization: TheiaLocalization = {
|
|
170
|
-
languageId: localization.languageId,
|
|
171
|
-
languageName: localization.languageName,
|
|
172
|
-
localizedLanguageName: localization.localizedLanguageName,
|
|
173
|
-
languagePack: true,
|
|
174
|
-
translations: {}
|
|
175
|
-
};
|
|
176
|
-
for (const translation of localization.translations) {
|
|
177
|
-
for (const [scope, value] of Object.entries(translation.contents)) {
|
|
178
|
-
for (const [key, item] of Object.entries(value)) {
|
|
179
|
-
const translationKey = buildTheiaTranslationKey(translation.id, scope, key);
|
|
180
|
-
theiaLocalization.translations[translationKey] = item;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
theiaLocalizations.push(theiaLocalization);
|
|
185
|
-
}
|
|
186
|
-
return theiaLocalizations;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
function buildTheiaTranslationKey(pluginId: string, scope: string, key: string): string {
|
|
190
|
-
const scopeSlashIndex = scope.lastIndexOf('/');
|
|
191
|
-
if (scopeSlashIndex >= 0) {
|
|
192
|
-
scope = scope.substring(scopeSlashIndex + 1);
|
|
193
|
-
}
|
|
194
|
-
return `${pluginId}/${scope}/${key}`;
|
|
195
|
-
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (C) 2021 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 WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
|
|
17
|
+
import * as path from 'path';
|
|
18
|
+
import * as fs from '@theia/core/shared/fs-extra';
|
|
19
|
+
import { LocalizationProvider } from '@theia/core/lib/node/i18n/localization-provider';
|
|
20
|
+
import { Localization } from '@theia/core/lib/common/i18n/localization';
|
|
21
|
+
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
22
|
+
import { DeployedPlugin, Localization as PluginLocalization, PluginContribution } from '../../common';
|
|
23
|
+
import { URI } from '@theia/core/shared/vscode-uri';
|
|
24
|
+
import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
|
|
25
|
+
|
|
26
|
+
export interface VSCodeNlsConfig {
|
|
27
|
+
locale: string
|
|
28
|
+
availableLanguages: Record<string, string>
|
|
29
|
+
_languagePackSupport?: boolean
|
|
30
|
+
_languagePackId?: string
|
|
31
|
+
_translationsConfigFile?: string
|
|
32
|
+
_cacheRoot?: string
|
|
33
|
+
_corruptedFile?: string
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@injectable()
|
|
37
|
+
export class HostedPluginLocalizationService {
|
|
38
|
+
|
|
39
|
+
@inject(LocalizationProvider)
|
|
40
|
+
protected readonly localizationProvider: LocalizationProvider;
|
|
41
|
+
|
|
42
|
+
@inject(EnvVariablesServer)
|
|
43
|
+
protected readonly envVariables: EnvVariablesServer;
|
|
44
|
+
|
|
45
|
+
protected translationConfigFiles: Map<string, string> = new Map();
|
|
46
|
+
|
|
47
|
+
deployLocalizations(plugin: DeployedPlugin): void {
|
|
48
|
+
if (plugin.contributes?.localizations) {
|
|
49
|
+
this.localizationProvider.addLocalizations(...buildLocalizations(plugin.contributes.localizations));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async localizePlugin(plugin: DeployedPlugin): Promise<DeployedPlugin> {
|
|
54
|
+
const currentLanguage = this.localizationProvider.getCurrentLanguage();
|
|
55
|
+
const localization = this.localizationProvider.loadLocalization(currentLanguage);
|
|
56
|
+
const pluginPath = URI.parse(plugin.metadata.model.packageUri).fsPath;
|
|
57
|
+
const pluginId = plugin.metadata.model.id;
|
|
58
|
+
// create a shallow copy to not override the original plugin's contributes property.
|
|
59
|
+
const shallowCopy = { ...plugin };
|
|
60
|
+
try {
|
|
61
|
+
const translations = await loadPackageTranslations(pluginPath, currentLanguage);
|
|
62
|
+
shallowCopy.contributes = localizePackage(shallowCopy.contributes, translations, (key, original) => {
|
|
63
|
+
const fullKey = `${pluginId}/package/${key}`;
|
|
64
|
+
return Localization.localize(localization, fullKey, original);
|
|
65
|
+
}) as PluginContribution;
|
|
66
|
+
} catch (err) {
|
|
67
|
+
console.error(`Failed to localize plugin '${pluginId}'.`, err);
|
|
68
|
+
}
|
|
69
|
+
return shallowCopy;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
getNlsConfig(): VSCodeNlsConfig {
|
|
73
|
+
const locale = this.localizationProvider.getCurrentLanguage();
|
|
74
|
+
const configFile = this.translationConfigFiles.get(locale);
|
|
75
|
+
if (locale === 'en' || !configFile) {
|
|
76
|
+
return { locale, availableLanguages: {} };
|
|
77
|
+
}
|
|
78
|
+
const cache = path.dirname(configFile);
|
|
79
|
+
return {
|
|
80
|
+
locale,
|
|
81
|
+
availableLanguages: { '*': locale },
|
|
82
|
+
_languagePackSupport: true,
|
|
83
|
+
_cacheRoot: cache,
|
|
84
|
+
_languagePackId: locale,
|
|
85
|
+
_translationsConfigFile: configFile
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async buildTranslationConfig(plugins: DeployedPlugin[]): Promise<void> {
|
|
90
|
+
const configDir = URI.parse(await this.envVariables.getConfigDirUri()).fsPath;
|
|
91
|
+
const cacheDir = path.join(configDir, 'localization-cache');
|
|
92
|
+
const configs = new Map<string, Record<string, string>>();
|
|
93
|
+
for (const plugin of plugins) {
|
|
94
|
+
if (plugin.contributes?.localizations) {
|
|
95
|
+
const pluginPath = URI.parse(plugin.metadata.model.packageUri).fsPath;
|
|
96
|
+
for (const localization of plugin.contributes.localizations) {
|
|
97
|
+
const config = configs.get(localization.languageId) || {};
|
|
98
|
+
for (const translation of localization.translations) {
|
|
99
|
+
const fullPath = path.join(pluginPath, translation.path);
|
|
100
|
+
config[translation.id] = fullPath;
|
|
101
|
+
}
|
|
102
|
+
configs.set(localization.languageId, config);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
for (const [language, config] of configs.entries()) {
|
|
108
|
+
const languageConfigDir = path.join(cacheDir, language);
|
|
109
|
+
await fs.mkdirs(languageConfigDir);
|
|
110
|
+
const configFile = path.join(languageConfigDir, `nls.config.${language}.json`);
|
|
111
|
+
this.translationConfigFiles.set(language, configFile);
|
|
112
|
+
await fs.writeJson(configFile, config);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function buildLocalizations(localizations: PluginLocalization[]): Localization[] {
|
|
118
|
+
const theiaLocalizations: Localization[] = [];
|
|
119
|
+
for (const localization of localizations) {
|
|
120
|
+
const theiaLocalization: Localization = {
|
|
121
|
+
languageId: localization.languageId,
|
|
122
|
+
languageName: localization.languageName,
|
|
123
|
+
localizedLanguageName: localization.localizedLanguageName,
|
|
124
|
+
languagePack: true,
|
|
125
|
+
translations: {}
|
|
126
|
+
};
|
|
127
|
+
for (const translation of localization.translations) {
|
|
128
|
+
for (const [scope, value] of Object.entries(translation.contents)) {
|
|
129
|
+
for (const [key, item] of Object.entries(value)) {
|
|
130
|
+
const translationKey = buildTranslationKey(translation.id, scope, key);
|
|
131
|
+
theiaLocalization.translations[translationKey] = item;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
theiaLocalizations.push(theiaLocalization);
|
|
136
|
+
}
|
|
137
|
+
return theiaLocalizations;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function buildTranslationKey(pluginId: string, scope: string, key: string): string {
|
|
141
|
+
return `${pluginId}/${Localization.transformKey(scope)}/${key}`;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
interface PackageTranslation {
|
|
145
|
+
translation?: Record<string, string>
|
|
146
|
+
default?: Record<string, string>
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
async function loadPackageTranslations(pluginPath: string, locale: string): Promise<PackageTranslation> {
|
|
150
|
+
const localizedPluginPath = path.join(pluginPath, `package.nls.${locale}.json`);
|
|
151
|
+
try {
|
|
152
|
+
const defaultValue = await fs.readJson(path.join(pluginPath, 'package.nls.json'));
|
|
153
|
+
if (await fs.pathExists(localizedPluginPath)) {
|
|
154
|
+
return {
|
|
155
|
+
translation: await fs.readJson(localizedPluginPath),
|
|
156
|
+
default: defaultValue
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
default: defaultValue
|
|
161
|
+
};
|
|
162
|
+
} catch (e) {
|
|
163
|
+
if (e.code !== 'ENOENT') {
|
|
164
|
+
throw e;
|
|
165
|
+
}
|
|
166
|
+
return {};
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const NLS_REGEX = /^%([\w\d.-]+)%$/i;
|
|
171
|
+
|
|
172
|
+
function localizePackage(value: unknown, translations: PackageTranslation, callback: (key: string, defaultValue: string) => string): unknown {
|
|
173
|
+
if (typeof value === 'string') {
|
|
174
|
+
const match = NLS_REGEX.exec(value);
|
|
175
|
+
let result = value;
|
|
176
|
+
if (match) {
|
|
177
|
+
const key = match[1];
|
|
178
|
+
if (translations.translation) {
|
|
179
|
+
result = translations.translation[key];
|
|
180
|
+
} else if (translations.default) {
|
|
181
|
+
result = callback(key, translations.default[key]);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return result;
|
|
185
|
+
}
|
|
186
|
+
if (Array.isArray(value)) {
|
|
187
|
+
const result = [];
|
|
188
|
+
for (const item of value) {
|
|
189
|
+
result.push(localizePackage(item, translations, callback));
|
|
190
|
+
}
|
|
191
|
+
return result;
|
|
192
|
+
}
|
|
193
|
+
if (typeof value === 'object' && value) {
|
|
194
|
+
const result: Record<string, unknown> = {};
|
|
195
|
+
for (const [name, item] of Object.entries(value)) {
|
|
196
|
+
result[name] = localizePackage(item, translations, callback);
|
|
197
|
+
}
|
|
198
|
+
return result;
|
|
199
|
+
}
|
|
200
|
+
return value;
|
|
201
|
+
}
|
|
@@ -23,7 +23,7 @@ import { MessageType } from '../../common/rpc-protocol';
|
|
|
23
23
|
import { HostedPluginCliContribution } from './hosted-plugin-cli-contribution';
|
|
24
24
|
import * as psTree from 'ps-tree';
|
|
25
25
|
import { Deferred } from '@theia/core/lib/common/promise-util';
|
|
26
|
-
import {
|
|
26
|
+
import { HostedPluginLocalizationService } from './hosted-plugin-localization-service';
|
|
27
27
|
|
|
28
28
|
export interface IPCConnectionOptions {
|
|
29
29
|
readonly serverName: string;
|
|
@@ -56,8 +56,8 @@ export class HostedPluginProcess implements ServerPluginRunner {
|
|
|
56
56
|
@inject(MessageService)
|
|
57
57
|
protected readonly messageService: MessageService;
|
|
58
58
|
|
|
59
|
-
@inject(
|
|
60
|
-
protected readonly
|
|
59
|
+
@inject(HostedPluginLocalizationService)
|
|
60
|
+
protected readonly localizationService: HostedPluginLocalizationService;
|
|
61
61
|
|
|
62
62
|
private childProcess: cp.ChildProcess | undefined;
|
|
63
63
|
private client: HostedPluginClient;
|
|
@@ -173,9 +173,7 @@ export class HostedPluginProcess implements ServerPluginRunner {
|
|
|
173
173
|
delete env[key];
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
|
-
|
|
177
|
-
const locale = this.localizationProvider.getCurrentLanguage();
|
|
178
|
-
env['VSCODE_NLS_CONFIG'] = JSON.stringify({ locale, availableLanguages });
|
|
176
|
+
env['VSCODE_NLS_CONFIG'] = JSON.stringify(this.localizationService.getNlsConfig());
|
|
179
177
|
// apply external env variables
|
|
180
178
|
this.pluginHostEnvironmentVariables.getContributions().forEach(envVar => envVar.process(env));
|
|
181
179
|
if (this.cli.extensionTestsPath) {
|
|
@@ -33,6 +33,7 @@ import { HostedPluginCliContribution } from './hosted-plugin-cli-contribution';
|
|
|
33
33
|
import { HostedPluginDeployerHandler } from './hosted-plugin-deployer-handler';
|
|
34
34
|
import { PluginUriFactory } from './scanners/plugin-uri-factory';
|
|
35
35
|
import { FilePluginUriFactory } from './scanners/file-plugin-uri-factory';
|
|
36
|
+
import { HostedPluginLocalizationService } from './hosted-plugin-localization-service';
|
|
36
37
|
|
|
37
38
|
const commonHostedConnectionModule = ConnectionContainerModule.create(({ bind, bindBackendService }) => {
|
|
38
39
|
bind(HostedPluginProcess).toSelf().inSingletonScope();
|
|
@@ -58,6 +59,7 @@ export function bindCommonHostedBackend(bind: interfaces.Bind): void {
|
|
|
58
59
|
bind(HostedPluginReader).toSelf().inSingletonScope();
|
|
59
60
|
bind(BackendApplicationContribution).toService(HostedPluginReader);
|
|
60
61
|
|
|
62
|
+
bind(HostedPluginLocalizationService).toSelf().inSingletonScope();
|
|
61
63
|
bind(HostedPluginDeployerHandler).toSelf().inSingletonScope();
|
|
62
64
|
bind(PluginDeployerHandler).toService(HostedPluginDeployerHandler);
|
|
63
65
|
|
|
@@ -14,68 +14,16 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
|
|
17
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
18
|
-
|
|
19
17
|
import * as path from 'path';
|
|
20
18
|
import * as fs from '@theia/core/shared/fs-extra';
|
|
21
19
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const [manifest, translations] = await Promise.all([
|
|
26
|
-
fs.readJson(path.join(pluginPath, 'package.json')),
|
|
27
|
-
loadTranslations(pluginPath, locale)
|
|
28
|
-
]);
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
|
+
export async function loadManifest(pluginPath: string): Promise<any> {
|
|
22
|
+
const manifest = await fs.readJson(path.join(pluginPath, 'package.json'));
|
|
29
23
|
// translate vscode builtins, as they are published with a prefix. See https://github.com/theia-ide/vscode-builtin-extensions/blob/master/src/republish.js#L50
|
|
30
24
|
const built_prefix = '@theia/vscode-builtin-';
|
|
31
25
|
if (manifest && manifest.name && manifest.name.startsWith(built_prefix)) {
|
|
32
26
|
manifest.name = manifest.name.substr(built_prefix.length);
|
|
33
27
|
}
|
|
34
|
-
return manifest
|
|
35
|
-
localize(manifest, translations) :
|
|
36
|
-
manifest;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
async function loadTranslations(pluginPath: string, locale?: string): Promise<any> {
|
|
40
|
-
try {
|
|
41
|
-
const localizedPluginPath = path.join(pluginPath, `package.nls.${locale}.json`);
|
|
42
|
-
if (await fs.pathExists(localizedPluginPath)) {
|
|
43
|
-
return await fs.readJson(localizedPluginPath);
|
|
44
|
-
} else {
|
|
45
|
-
return await fs.readJson(path.join(pluginPath, 'package.nls.json'));
|
|
46
|
-
}
|
|
47
|
-
} catch (e) {
|
|
48
|
-
if (e.code !== 'ENOENT') {
|
|
49
|
-
throw e;
|
|
50
|
-
}
|
|
51
|
-
return {};
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function localize(value: any, translations: {
|
|
56
|
-
[key: string]: string
|
|
57
|
-
}): any {
|
|
58
|
-
if (typeof value === 'string') {
|
|
59
|
-
const match = NLS_REGEX.exec(value);
|
|
60
|
-
return match && translations[match[1]] || value;
|
|
61
|
-
}
|
|
62
|
-
if (Array.isArray(value)) {
|
|
63
|
-
const result = [];
|
|
64
|
-
for (const item of value) {
|
|
65
|
-
result.push(localize(item, translations));
|
|
66
|
-
}
|
|
67
|
-
return result;
|
|
68
|
-
}
|
|
69
|
-
if (value === null) {
|
|
70
|
-
return value;
|
|
71
|
-
}
|
|
72
|
-
if (typeof value === 'object') {
|
|
73
|
-
const result: { [key: string]: any } = {};
|
|
74
|
-
// eslint-disable-next-line guard-for-in
|
|
75
|
-
for (const propertyName in value) {
|
|
76
|
-
result[propertyName] = localize(value[propertyName], translations);
|
|
77
|
-
}
|
|
78
|
-
return result;
|
|
79
|
-
}
|
|
80
|
-
return value;
|
|
28
|
+
return manifest;
|
|
81
29
|
}
|
|
@@ -16,13 +16,11 @@
|
|
|
16
16
|
import { injectable, inject, named, postConstruct } from '@theia/core/shared/inversify';
|
|
17
17
|
import { HostedPluginServer, HostedPluginClient, PluginDeployer, GetDeployedPluginsParams, DeployedPlugin } from '../../common/plugin-protocol';
|
|
18
18
|
import { HostedPluginSupport } from './hosted-plugin';
|
|
19
|
-
import { ILogger, Disposable } from '@theia/core';
|
|
20
|
-
import { ContributionProvider } from '@theia/core';
|
|
19
|
+
import { ILogger, Disposable, ContributionProvider } from '@theia/core';
|
|
21
20
|
import { ExtPluginApiProvider, ExtPluginApi } from '../../common/plugin-ext-api-contribution';
|
|
22
21
|
import { HostedPluginDeployerHandler } from './hosted-plugin-deployer-handler';
|
|
23
22
|
import { PluginDeployerImpl } from '../../main/node/plugin-deployer-impl';
|
|
24
|
-
import {
|
|
25
|
-
import { loadManifest } from './plugin-manifest-loader';
|
|
23
|
+
import { HostedPluginLocalizationService } from './hosted-plugin-localization-service';
|
|
26
24
|
|
|
27
25
|
@injectable()
|
|
28
26
|
export class HostedPluginServerImpl implements HostedPluginServer {
|
|
@@ -35,8 +33,8 @@ export class HostedPluginServerImpl implements HostedPluginServer {
|
|
|
35
33
|
@inject(PluginDeployer)
|
|
36
34
|
protected readonly pluginDeployer: PluginDeployerImpl;
|
|
37
35
|
|
|
38
|
-
@inject(
|
|
39
|
-
protected readonly
|
|
36
|
+
@inject(HostedPluginLocalizationService)
|
|
37
|
+
protected readonly localizationService: HostedPluginLocalizationService;
|
|
40
38
|
|
|
41
39
|
@inject(ContributionProvider)
|
|
42
40
|
@named(Symbol.for(ExtPluginApiProvider))
|
|
@@ -90,8 +88,7 @@ export class HostedPluginServerImpl implements HostedPluginServer {
|
|
|
90
88
|
if (!pluginIds.length) {
|
|
91
89
|
return [];
|
|
92
90
|
}
|
|
93
|
-
const
|
|
94
|
-
const plugins = [];
|
|
91
|
+
const plugins: DeployedPlugin[] = [];
|
|
95
92
|
let extraDeployedPlugins: Map<string, DeployedPlugin> | undefined;
|
|
96
93
|
for (const pluginId of pluginIds) {
|
|
97
94
|
let plugin = this.deployerHandler.getDeployedPlugin(pluginId);
|
|
@@ -105,10 +102,10 @@ export class HostedPluginServerImpl implements HostedPluginServer {
|
|
|
105
102
|
plugin = extraDeployedPlugins.get(pluginId);
|
|
106
103
|
}
|
|
107
104
|
if (plugin) {
|
|
108
|
-
plugins.push(
|
|
105
|
+
plugins.push(plugin);
|
|
109
106
|
}
|
|
110
107
|
}
|
|
111
|
-
return plugins;
|
|
108
|
+
return Promise.all(plugins.map(plugin => this.localizationService.localizePlugin(plugin)));
|
|
112
109
|
}
|
|
113
110
|
|
|
114
111
|
onMessage(pluginHostId: string, message: string): Promise<void> {
|
|
@@ -119,34 +116,4 @@ export class HostedPluginServerImpl implements HostedPluginServer {
|
|
|
119
116
|
getExtPluginAPI(): Promise<ExtPluginApi[]> {
|
|
120
117
|
return Promise.resolve(this.extPluginAPIContributions.getContributions().map(p => p.provideApi()));
|
|
121
118
|
}
|
|
122
|
-
|
|
123
|
-
protected async localizePlugin(plugin: DeployedPlugin, locale: string): Promise<DeployedPlugin> {
|
|
124
|
-
const packagePath = plugin.metadata.model.packagePath;
|
|
125
|
-
const translatedManifest = await loadManifest(packagePath, locale);
|
|
126
|
-
this.mergeContributes(plugin.contributes, translatedManifest.contributes);
|
|
127
|
-
return plugin;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
131
|
-
protected mergeContributes(main: any, other: any): void {
|
|
132
|
-
if (main && other) {
|
|
133
|
-
if (Array.isArray(main) && Array.isArray(other)) {
|
|
134
|
-
for (let i = 0; i < main.length && i < other.length; i++) {
|
|
135
|
-
if (typeof main[i] === 'object' && typeof other[i] === 'object') {
|
|
136
|
-
this.mergeContributes(main[i], other[i]);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
} else {
|
|
140
|
-
for (const [key, value] of Object.entries(main)) {
|
|
141
|
-
if (key in other) {
|
|
142
|
-
if (typeof value === 'string') {
|
|
143
|
-
main[key] = other[key];
|
|
144
|
-
} else if (typeof value === 'object' && typeof other[key] === 'object') {
|
|
145
|
-
this.mergeContributes(main[key], other[key]);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
119
|
}
|
|
@@ -73,7 +73,7 @@ import {
|
|
|
73
73
|
ProblemPatternContribution,
|
|
74
74
|
TaskDefinition
|
|
75
75
|
} from '@theia/task/lib/common/task-protocol';
|
|
76
|
-
import { ColorDefinition } from '@theia/core/lib/
|
|
76
|
+
import { ColorDefinition } from '@theia/core/lib/common/color';
|
|
77
77
|
import { ResourceLabelFormatter } from '@theia/core/lib/common/label-protocol';
|
|
78
78
|
import { PluginUriFactory } from './plugin-uri-factory';
|
|
79
79
|
|
|
@@ -217,7 +217,7 @@ export class TheiaPluginScanner implements PluginScanner {
|
|
|
217
217
|
|
|
218
218
|
for (const location of Object.keys(viewsContainers)) {
|
|
219
219
|
const containers = this.readViewsContainers(viewsContainers[location], rawPlugin);
|
|
220
|
-
const loc = location === 'activitybar' ? 'left' : location;
|
|
220
|
+
const loc = location === 'activitybar' ? 'left' : location === 'panel' ? 'bottom' : location;
|
|
221
221
|
if (contributions.viewsContainers[loc]) {
|
|
222
222
|
contributions.viewsContainers[loc] = contributions.viewsContainers[loc].concat(containers);
|
|
223
223
|
} else {
|
|
@@ -381,6 +381,7 @@ export class TheiaPluginScanner implements PluginScanner {
|
|
|
381
381
|
throw new Error(`Could not read json file '${packageTranslation.path}'.`);
|
|
382
382
|
}
|
|
383
383
|
translation.id = packageTranslation.id;
|
|
384
|
+
translation.path = packageTranslation.path;
|
|
384
385
|
return translation;
|
|
385
386
|
}
|
|
386
387
|
|
|
@@ -553,10 +554,13 @@ export class TheiaPluginScanner implements PluginScanner {
|
|
|
553
554
|
}
|
|
554
555
|
|
|
555
556
|
private readViewContainer(rawViewContainer: PluginPackageViewContainer, pck: PluginPackage): ViewContainer {
|
|
557
|
+
const themeIcon = rawViewContainer.icon.startsWith('$(') ? rawViewContainer.icon : undefined;
|
|
558
|
+
const iconUrl = this.toPluginUrl(pck, rawViewContainer.icon);
|
|
556
559
|
return {
|
|
557
560
|
id: rawViewContainer.id,
|
|
558
561
|
title: rawViewContainer.title,
|
|
559
|
-
iconUrl
|
|
562
|
+
iconUrl,
|
|
563
|
+
themeIcon,
|
|
560
564
|
};
|
|
561
565
|
}
|
|
562
566
|
|
|
@@ -151,7 +151,9 @@ export function toDefinition(definition: model.CallHierarchyDefinition | undefin
|
|
|
151
151
|
selectionRange: toRange(definition.selectionRange),
|
|
152
152
|
symbolName: definition.name,
|
|
153
153
|
symbolKind: SymbolKindConverter.toSymbolKind(definition.kind),
|
|
154
|
-
containerName: undefined
|
|
154
|
+
containerName: undefined,
|
|
155
|
+
tags: definition.tags,
|
|
156
|
+
data: definition.data,
|
|
155
157
|
};
|
|
156
158
|
}
|
|
157
159
|
|
|
@@ -161,7 +163,9 @@ export function fromDefinition(definition: CallHierarchyDefinition): model.CallH
|
|
|
161
163
|
range: fromRange(definition.location.range),
|
|
162
164
|
selectionRange: fromRange(definition.selectionRange),
|
|
163
165
|
name: definition.symbolName,
|
|
164
|
-
kind: SymbolKindConverter.fromSymbolKind(definition.symbolKind)
|
|
166
|
+
kind: SymbolKindConverter.fromSymbolKind(definition.symbolKind),
|
|
167
|
+
tags: definition.tags,
|
|
168
|
+
data: definition.data,
|
|
165
169
|
};
|
|
166
170
|
}
|
|
167
171
|
|
|
@@ -17,9 +17,8 @@
|
|
|
17
17
|
import { inject } from '@theia/core/shared/inversify';
|
|
18
18
|
import URI from '@theia/core/lib/common/uri';
|
|
19
19
|
import { ApplicationShell, OpenerOptions, OpenHandler, Widget, WidgetManager } from '@theia/core/lib/browser';
|
|
20
|
-
import { CustomEditorPriority, CustomEditorSelector } from '../../../common';
|
|
20
|
+
import { CustomEditor, CustomEditorPriority, CustomEditorSelector } from '../../../common';
|
|
21
21
|
import * as glob from './glob';
|
|
22
|
-
import { CustomEditor } from '../../../common';
|
|
23
22
|
import { CustomEditorWidget } from './custom-editor-widget';
|
|
24
23
|
import { v4 } from 'uuid';
|
|
25
24
|
import { Emitter } from '@theia/core';
|
|
@@ -37,10 +36,14 @@ export class CustomEditorOpener implements OpenHandler {
|
|
|
37
36
|
@inject(ApplicationShell) protected readonly shell: ApplicationShell,
|
|
38
37
|
@inject(WidgetManager) protected readonly widgetManager: WidgetManager
|
|
39
38
|
) {
|
|
40
|
-
this.id =
|
|
39
|
+
this.id = CustomEditorOpener.toCustomEditorId(this.editor.viewType);
|
|
41
40
|
this.label = this.editor.displayName;
|
|
42
41
|
}
|
|
43
42
|
|
|
43
|
+
static toCustomEditorId(editorViewType: string): string {
|
|
44
|
+
return `custom-editor-${editorViewType}`;
|
|
45
|
+
}
|
|
46
|
+
|
|
44
47
|
canHandle(uri: URI): number {
|
|
45
48
|
if (this.matches(this.editor.selector, uri)) {
|
|
46
49
|
return this.getPriority();
|
|
@@ -52,7 +55,8 @@ export class CustomEditorOpener implements OpenHandler {
|
|
|
52
55
|
switch (this.editor.priority) {
|
|
53
56
|
case CustomEditorPriority.default: return 500;
|
|
54
57
|
case CustomEditorPriority.builtin: return 400;
|
|
55
|
-
|
|
58
|
+
/** `option` should not open the custom-editor by default. */
|
|
59
|
+
case CustomEditorPriority.option: return 1;
|
|
56
60
|
default: return 200;
|
|
57
61
|
}
|
|
58
62
|
}
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
// some code copied and modified from https://github.com/microsoft/vscode/blob/53eac52308c4611000a171cc7bf1214293473c78/src/vs/workbench/api/browser/mainThreadCustomEditors.ts
|
|
21
21
|
|
|
22
22
|
import { interfaces } from '@theia/core/shared/inversify';
|
|
23
|
-
import { MAIN_RPC_CONTEXT, CustomEditorsMain, CustomEditorsExt, CustomTextEditorCapabilities } from '../../../common/plugin-api-rpc';
|
|
23
|
+
import { MAIN_RPC_CONTEXT, CustomEditorsMain, CustomEditorsExt, CustomTextEditorCapabilities, EditorPosition } from '../../../common/plugin-api-rpc';
|
|
24
24
|
import { RPCProtocol } from '../../../common/rpc-protocol';
|
|
25
25
|
import { HostedPluginSupport } from '../../../hosted/browser/hosted-plugin';
|
|
26
26
|
import { PluginCustomEditorRegistry } from './plugin-custom-editor-registry';
|
|
@@ -43,7 +43,6 @@ import { ApplicationShell, DefaultUriLabelProviderContribution, Saveable, SaveOp
|
|
|
43
43
|
import { WebviewOptions, WebviewPanelOptions, ViewColumn } from '@theia/plugin';
|
|
44
44
|
import { WebviewWidgetIdentifier } from '../webview/webview';
|
|
45
45
|
import { EditorPreferences } from '@theia/editor/lib/browser';
|
|
46
|
-
import { EditorPosition } from '../../../common/plugin-api-rpc';
|
|
47
46
|
|
|
48
47
|
const enum CustomEditorModelType {
|
|
49
48
|
Custom,
|