@theia/plugin-ext 1.45.0 → 1.46.0
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/lib/common/plugin-api-rpc.d.ts +9 -4
- package/lib/common/plugin-api-rpc.d.ts.map +1 -1
- package/lib/common/plugin-api-rpc.js +3 -1
- package/lib/common/plugin-api-rpc.js.map +1 -1
- package/lib/common/plugin-ext-api-contribution.d.ts +35 -5
- package/lib/common/plugin-ext-api-contribution.d.ts.map +1 -1
- package/lib/common/plugin-ext-api-contribution.js.map +1 -1
- package/lib/common/plugin-protocol.d.ts +5 -2
- package/lib/common/plugin-protocol.d.ts.map +1 -1
- package/lib/common/plugin-protocol.js +1 -0
- package/lib/common/plugin-protocol.js.map +1 -1
- package/lib/common/proxy-handler.d.ts +7 -0
- package/lib/common/proxy-handler.d.ts.map +1 -1
- package/lib/common/proxy-handler.js +5 -1
- package/lib/common/proxy-handler.js.map +1 -1
- package/lib/common/rpc-protocol.d.ts +10 -0
- package/lib/common/rpc-protocol.d.ts.map +1 -1
- package/lib/common/rpc-protocol.js +32 -3
- package/lib/common/rpc-protocol.js.map +1 -1
- package/lib/hosted/browser/hosted-plugin.d.ts +16 -74
- package/lib/hosted/browser/hosted-plugin.d.ts.map +1 -1
- package/lib/hosted/browser/hosted-plugin.js +41 -314
- package/lib/hosted/browser/hosted-plugin.js.map +1 -1
- package/lib/hosted/browser/worker/debug-stub.d.ts +2 -2
- package/lib/hosted/browser/worker/debug-stub.d.ts.map +1 -1
- package/lib/hosted/browser/worker/debug-stub.js +3 -3
- package/lib/hosted/browser/worker/debug-stub.js.map +1 -1
- package/lib/hosted/browser/worker/worker-env-ext.d.ts +1 -2
- package/lib/hosted/browser/worker/worker-env-ext.d.ts.map +1 -1
- package/lib/hosted/browser/worker/worker-env-ext.js +18 -4
- package/lib/hosted/browser/worker/worker-env-ext.js.map +1 -1
- package/lib/hosted/browser/worker/worker-main.js +20 -32
- package/lib/hosted/browser/worker/worker-main.js.map +1 -1
- package/lib/hosted/browser/worker/worker-plugin-module.d.ts +5 -0
- package/lib/hosted/browser/worker/worker-plugin-module.d.ts.map +1 -0
- package/lib/hosted/browser/worker/worker-plugin-module.js +71 -0
- package/lib/hosted/browser/worker/worker-plugin-module.js.map +1 -0
- package/lib/hosted/common/hosted-plugin.d.ts +97 -0
- package/lib/hosted/common/hosted-plugin.d.ts.map +1 -0
- package/lib/hosted/common/hosted-plugin.js +408 -0
- package/lib/hosted/common/hosted-plugin.js.map +1 -0
- package/lib/hosted/node/hosted-plugin-process.d.ts +1 -1
- package/lib/hosted/node/hosted-plugin-process.d.ts.map +1 -1
- package/lib/hosted/node/hosted-plugin-process.js +2 -2
- 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-host-module.d.ts +5 -0
- package/lib/hosted/node/plugin-host-module.d.ts.map +1 -0
- package/lib/hosted/node/plugin-host-module.js +68 -0
- package/lib/hosted/node/plugin-host-module.js.map +1 -0
- package/lib/hosted/node/plugin-host-rpc.d.ts +93 -7
- package/lib/hosted/node/plugin-host-rpc.d.ts.map +1 -1
- package/lib/hosted/node/plugin-host-rpc.js +202 -53
- package/lib/hosted/node/plugin-host-rpc.js.map +1 -1
- package/lib/hosted/node/plugin-host.js +6 -5
- package/lib/hosted/node/plugin-host.js.map +1 -1
- package/lib/hosted/node/plugin-reader.d.ts.map +1 -1
- package/lib/hosted/node/plugin-reader.js +3 -0
- package/lib/hosted/node/plugin-reader.js.map +1 -1
- package/lib/hosted/node/plugin-service.d.ts +8 -0
- package/lib/hosted/node/plugin-service.d.ts.map +1 -1
- package/lib/hosted/node/plugin-service.js +14 -4
- package/lib/hosted/node/plugin-service.js.map +1 -1
- package/lib/hosted/node/scanners/file-plugin-uri-factory.js +1 -1
- package/lib/hosted/node/scanners/file-plugin-uri-factory.js.map +1 -1
- package/lib/hosted/node/scanners/scanner-theia.d.ts +17 -3
- package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
- package/lib/hosted/node/scanners/scanner-theia.js +48 -19
- package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
- package/lib/main/browser/authentication-main.d.ts.map +1 -1
- package/lib/main/browser/authentication-main.js +3 -1
- package/lib/main/browser/authentication-main.js.map +1 -1
- package/lib/main/browser/env-main.d.ts +1 -10
- package/lib/main/browser/env-main.d.ts.map +1 -1
- package/lib/main/browser/env-main.js +2 -21
- package/lib/main/browser/env-main.js.map +1 -1
- package/lib/main/browser/menus/menus-contribution-handler.d.ts.map +1 -1
- package/lib/main/browser/menus/menus-contribution-handler.js +6 -3
- package/lib/main/browser/menus/menus-contribution-handler.js.map +1 -1
- package/lib/main/browser/menus/plugin-menu-command-adapter.js +1 -1
- package/lib/main/browser/menus/plugin-menu-command-adapter.js.map +1 -1
- package/lib/main/browser/message-registry-main.d.ts +6 -4
- package/lib/main/browser/message-registry-main.d.ts.map +1 -1
- package/lib/main/browser/message-registry-main.js +7 -19
- package/lib/main/browser/message-registry-main.js.map +1 -1
- package/lib/main/browser/notebooks/renderers/cell-output-webview.d.ts +1 -0
- package/lib/main/browser/notebooks/renderers/cell-output-webview.d.ts.map +1 -1
- package/lib/main/browser/notebooks/renderers/cell-output-webview.js +23 -22
- package/lib/main/browser/notebooks/renderers/cell-output-webview.js.map +1 -1
- package/lib/main/browser/notebooks/renderers/output-webview-internal.d.ts.map +1 -1
- package/lib/main/browser/notebooks/renderers/output-webview-internal.js +22 -14
- package/lib/main/browser/notebooks/renderers/output-webview-internal.js.map +1 -1
- package/lib/main/browser/notebooks/renderers/webview-communication.d.ts +2 -1
- package/lib/main/browser/notebooks/renderers/webview-communication.d.ts.map +1 -1
- package/lib/main/browser/notification-main.d.ts +2 -14
- package/lib/main/browser/notification-main.d.ts.map +1 -1
- package/lib/main/browser/notification-main.js +3 -52
- package/lib/main/browser/notification-main.js.map +1 -1
- package/lib/main/browser/terminal-main.d.ts +1 -1
- package/lib/main/browser/terminal-main.d.ts.map +1 -1
- package/lib/main/browser/terminal-main.js +2 -2
- package/lib/main/browser/terminal-main.js.map +1 -1
- package/lib/main/browser/view/plugin-view-registry.d.ts.map +1 -1
- package/lib/main/browser/view/plugin-view-registry.js +5 -2
- package/lib/main/browser/view/plugin-view-registry.js.map +1 -1
- package/lib/main/browser/webview/webview-context-keys.d.ts +5 -1
- package/lib/main/browser/webview/webview-context-keys.d.ts.map +1 -1
- package/lib/main/browser/webview/webview-context-keys.js +13 -4
- package/lib/main/browser/webview/webview-context-keys.js.map +1 -1
- package/lib/main/browser/webview/webview-widget-factory.d.ts.map +1 -1
- package/lib/main/browser/webview/webview-widget-factory.js +2 -1
- package/lib/main/browser/webview/webview-widget-factory.js.map +1 -1
- package/lib/main/browser/webview/webview.d.ts +1 -0
- package/lib/main/browser/webview/webview.d.ts.map +1 -1
- package/lib/main/browser/webview/webview.js +1 -0
- package/lib/main/browser/webview/webview.js.map +1 -1
- package/lib/main/browser/webviews-main.d.ts.map +1 -1
- package/lib/main/browser/webviews-main.js +7 -2
- package/lib/main/browser/webviews-main.js.map +1 -1
- package/lib/main/common/basic-message-registry-main.d.ts +14 -0
- package/lib/main/common/basic-message-registry-main.d.ts.map +1 -0
- package/lib/main/common/basic-message-registry-main.js +50 -0
- package/lib/main/common/basic-message-registry-main.js.map +1 -0
- package/lib/main/common/basic-notification-main.d.ts +19 -0
- package/lib/main/common/basic-notification-main.d.ts.map +1 -0
- package/lib/main/common/basic-notification-main.js +75 -0
- package/lib/main/common/basic-notification-main.js.map +1 -0
- package/lib/main/common/env-main.d.ts +11 -0
- package/lib/main/common/env-main.d.ts.map +1 -0
- package/lib/main/common/env-main.js +40 -0
- package/lib/main/common/env-main.js.map +1 -0
- package/lib/main/node/handlers/plugin-theia-directory-handler.d.ts +8 -3
- package/lib/main/node/handlers/plugin-theia-directory-handler.d.ts.map +1 -1
- package/lib/main/node/handlers/plugin-theia-directory-handler.js +38 -20
- package/lib/main/node/handlers/plugin-theia-directory-handler.js.map +1 -1
- package/lib/main/node/handlers/plugin-theia-file-handler.js +1 -1
- package/lib/main/node/handlers/plugin-theia-file-handler.js.map +1 -1
- package/lib/main/node/plugin-deployer-impl.d.ts.map +1 -1
- package/lib/main/node/plugin-deployer-impl.js +5 -1
- package/lib/main/node/plugin-deployer-impl.js.map +1 -1
- package/lib/main/node/plugins-key-value-storage.js +1 -1
- package/lib/main/node/plugins-key-value-storage.js.map +1 -1
- package/lib/plugin/clipboard-ext.d.ts +3 -2
- package/lib/plugin/clipboard-ext.d.ts.map +1 -1
- package/lib/plugin/clipboard-ext.js +28 -4
- package/lib/plugin/clipboard-ext.js.map +1 -1
- package/lib/plugin/debug/debug-ext.d.ts +3 -1
- package/lib/plugin/debug/debug-ext.d.ts.map +1 -1
- package/lib/plugin/debug/debug-ext.js +31 -4
- package/lib/plugin/debug/debug-ext.js.map +1 -1
- package/lib/plugin/documents.js +2 -2
- package/lib/plugin/documents.js.map +1 -1
- package/lib/plugin/editors-and-documents.d.ts +1 -2
- package/lib/plugin/editors-and-documents.d.ts.map +1 -1
- package/lib/plugin/editors-and-documents.js +21 -4
- package/lib/plugin/editors-and-documents.js.map +1 -1
- package/lib/plugin/env.d.ts +6 -2
- package/lib/plugin/env.d.ts.map +1 -1
- package/lib/plugin/env.js +37 -4
- package/lib/plugin/env.js.map +1 -1
- package/lib/plugin/localization-ext.d.ts +3 -2
- package/lib/plugin/localization-ext.d.ts.map +1 -1
- package/lib/plugin/localization-ext.js +30 -4
- package/lib/plugin/localization-ext.js.map +1 -1
- package/lib/plugin/message-registry.d.ts +2 -1
- package/lib/plugin/message-registry.d.ts.map +1 -1
- package/lib/plugin/message-registry.js +28 -4
- package/lib/plugin/message-registry.js.map +1 -1
- package/lib/plugin/node/debug/debug.spec.js +21 -1
- package/lib/plugin/node/debug/debug.spec.js.map +1 -1
- package/lib/plugin/node/env-node-ext.d.ts +1 -6
- package/lib/plugin/node/env-node-ext.d.ts.map +1 -1
- package/lib/plugin/node/env-node-ext.js +18 -10
- package/lib/plugin/node/env-node-ext.js.map +1 -1
- package/lib/plugin/node/plugin-container-module.d.ts +75 -0
- package/lib/plugin/node/plugin-container-module.d.ts.map +1 -0
- package/lib/plugin/node/plugin-container-module.js +115 -0
- package/lib/plugin/node/plugin-container-module.js.map +1 -0
- package/lib/plugin/notebook/notebook-kernels.d.ts.map +1 -1
- package/lib/plugin/notebook/notebook-kernels.js +0 -1
- package/lib/plugin/notebook/notebook-kernels.js.map +1 -1
- package/lib/plugin/plugin-context.d.ts.map +1 -1
- package/lib/plugin/plugin-context.js +9 -1
- package/lib/plugin/plugin-context.js.map +1 -1
- package/lib/plugin/plugin-manager.d.ts +26 -17
- package/lib/plugin/plugin-manager.d.ts.map +1 -1
- package/lib/plugin/plugin-manager.js +107 -37
- package/lib/plugin/plugin-manager.js.map +1 -1
- package/lib/plugin/plugin-storage.d.ts +11 -3
- package/lib/plugin/plugin-storage.d.ts.map +1 -1
- package/lib/plugin/plugin-storage.js +25 -5
- package/lib/plugin/plugin-storage.js.map +1 -1
- package/lib/plugin/preference-registry.d.ts +3 -2
- package/lib/plugin/preference-registry.d.ts.map +1 -1
- package/lib/plugin/preference-registry.js +35 -5
- package/lib/plugin/preference-registry.js.map +1 -1
- package/lib/plugin/preference-registry.spec.js +8 -1
- package/lib/plugin/preference-registry.spec.js.map +1 -1
- package/lib/plugin/quick-open.js +3 -3
- package/lib/plugin/quick-open.js.map +1 -1
- package/lib/plugin/secrets-ext.d.ts +16 -7
- package/lib/plugin/secrets-ext.d.ts.map +1 -1
- package/lib/plugin/secrets-ext.js +23 -3
- package/lib/plugin/secrets-ext.js.map +1 -1
- package/lib/plugin/terminal-ext.d.ts +1 -1
- package/lib/plugin/terminal-ext.d.ts.map +1 -1
- package/lib/plugin/terminal-ext.js +26 -6
- package/lib/plugin/terminal-ext.js.map +1 -1
- package/lib/plugin/types-impl.d.ts +22 -2
- package/lib/plugin/types-impl.d.ts.map +1 -1
- package/lib/plugin/types-impl.js +22 -6
- package/lib/plugin/types-impl.js.map +1 -1
- package/lib/plugin/webview-views.d.ts.map +1 -1
- package/lib/plugin/webview-views.js +2 -1
- package/lib/plugin/webview-views.js.map +1 -1
- package/lib/plugin/webviews.d.ts +7 -5
- package/lib/plugin/webviews.d.ts.map +1 -1
- package/lib/plugin/webviews.js +46 -12
- package/lib/plugin/webviews.js.map +1 -1
- package/lib/plugin/workspace.d.ts +4 -3
- package/lib/plugin/workspace.d.ts.map +1 -1
- package/lib/plugin/workspace.js +40 -6
- package/lib/plugin/workspace.js.map +1 -1
- package/package.json +29 -29
- package/src/common/plugin-api-rpc.ts +10 -6
- package/src/common/plugin-ext-api-contribution.ts +38 -5
- package/src/common/plugin-protocol.ts +7 -2
- package/src/common/proxy-handler.ts +14 -1
- package/src/common/rpc-protocol.ts +41 -3
- package/src/hosted/browser/hosted-plugin.ts +47 -337
- package/src/hosted/browser/worker/debug-stub.ts +4 -3
- package/src/hosted/browser/worker/worker-env-ext.ts +5 -4
- package/src/hosted/browser/worker/worker-main.ts +103 -115
- package/src/hosted/browser/worker/worker-plugin-module.ts +73 -0
- package/src/hosted/common/hosted-plugin.ts +456 -0
- package/src/hosted/node/hosted-plugin-process.ts +4 -4
- package/src/hosted/node/plugin-ext-hosted-backend-module.ts +3 -1
- package/src/hosted/node/plugin-host-module.ts +69 -0
- package/src/hosted/node/plugin-host-rpc.ts +232 -73
- package/src/hosted/node/plugin-host.ts +9 -7
- package/src/hosted/node/plugin-reader.ts +3 -0
- package/src/hosted/node/plugin-service.ts +21 -4
- package/src/hosted/node/scanners/file-plugin-uri-factory.ts +1 -1
- package/src/hosted/node/scanners/scanner-theia.ts +46 -12
- package/src/main/browser/authentication-main.ts +3 -1
- package/src/main/browser/env-main.ts +1 -28
- package/src/main/browser/menus/menus-contribution-handler.ts +8 -3
- package/src/main/browser/menus/plugin-menu-command-adapter.ts +1 -1
- package/src/main/browser/message-registry-main.ts +10 -23
- package/src/main/browser/notebooks/renderers/cell-output-webview.tsx +26 -24
- package/src/main/browser/notebooks/renderers/output-webview-internal.ts +22 -13
- package/src/main/browser/notebooks/renderers/webview-communication.ts +2 -1
- package/src/main/browser/notification-main.ts +4 -64
- package/src/main/browser/terminal-main.ts +2 -2
- package/src/main/browser/view/plugin-view-registry.ts +6 -3
- package/src/main/browser/webview/webview-context-keys.ts +17 -4
- package/src/main/browser/webview/webview-widget-factory.ts +2 -1
- package/src/main/browser/webview/webview.ts +2 -0
- package/src/main/browser/webviews-main.ts +7 -2
- package/src/main/common/basic-message-registry-main.ts +53 -0
- package/src/main/common/basic-notification-main.ts +86 -0
- package/src/main/common/env-main.ts +44 -0
- package/src/main/node/handlers/plugin-theia-directory-handler.ts +38 -16
- package/src/main/node/handlers/plugin-theia-file-handler.ts +1 -1
- package/src/main/node/plugin-deployer-impl.ts +5 -1
- package/src/main/node/plugins-key-value-storage.ts +1 -1
- package/src/plugin/clipboard-ext.ts +9 -3
- package/src/plugin/debug/debug-ext.ts +11 -2
- package/src/plugin/documents.ts +2 -2
- package/src/plugin/editors-and-documents.ts +5 -3
- package/src/plugin/env.ts +19 -3
- package/src/plugin/localization-ext.ts +8 -3
- package/src/plugin/message-registry.ts +7 -2
- package/src/plugin/node/debug/debug.spec.ts +5 -1
- package/src/plugin/node/env-node-ext.ts +5 -10
- package/src/plugin/node/plugin-container-module.ts +165 -0
- package/src/plugin/notebook/notebook-kernels.ts +0 -1
- package/src/plugin/plugin-context.ts +11 -2
- package/src/plugin/plugin-manager.ts +99 -45
- package/src/plugin/plugin-storage.ts +22 -4
- package/src/plugin/preference-registry.spec.ts +6 -1
- package/src/plugin/preference-registry.ts +11 -5
- package/src/plugin/quick-open.ts +3 -3
- package/src/plugin/secrets-ext.ts +25 -5
- package/src/plugin/terminal-ext.ts +5 -3
- package/src/plugin/types-impl.ts +30 -2
- package/src/plugin/webview-views.ts +2 -1
- package/src/plugin/webviews.ts +22 -13
- package/src/plugin/workspace.ts +14 -4
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2018 Red Hat, Inc. 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 { NotificationExt, NotificationMain } from '../../common';
|
|
18
|
+
import { ProgressService, Progress, ProgressMessage } from '@theia/core/lib/common';
|
|
19
|
+
import { interfaces } from '@theia/core/shared/inversify';
|
|
20
|
+
import { ProxyIdentifier, RPCProtocol } from '../../common/rpc-protocol';
|
|
21
|
+
import { Disposable, DisposableCollection } from '@theia/core/lib/common/disposable';
|
|
22
|
+
|
|
23
|
+
export class BasicNotificationMainImpl implements NotificationMain, Disposable {
|
|
24
|
+
protected readonly progressService: ProgressService;
|
|
25
|
+
protected readonly progressMap = new Map<string, Progress>();
|
|
26
|
+
protected readonly progress2Work = new Map<string, number>();
|
|
27
|
+
protected readonly proxy: NotificationExt;
|
|
28
|
+
|
|
29
|
+
protected readonly toDispose = new DisposableCollection(
|
|
30
|
+
Disposable.create(() => { /* mark as not disposed */ })
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
constructor(rpc: RPCProtocol, container: interfaces.Container, extIdentifier: ProxyIdentifier<NotificationExt>) {
|
|
34
|
+
this.progressService = container.get(ProgressService);
|
|
35
|
+
this.proxy = rpc.getProxy(extIdentifier);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
dispose(): void {
|
|
39
|
+
this.toDispose.dispose();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async $startProgress(options: NotificationMain.StartProgressOptions): Promise<string> {
|
|
43
|
+
const onDidCancel = () => {
|
|
44
|
+
// If the map does not contain current id, it has already stopped and should not be cancelled
|
|
45
|
+
if (this.progressMap.has(id)) {
|
|
46
|
+
this.proxy.$acceptProgressCanceled(id);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const progressMessage = this.mapOptions(options);
|
|
51
|
+
const progress = await this.progressService.showProgress(progressMessage, onDidCancel);
|
|
52
|
+
const id = progress.id;
|
|
53
|
+
this.progressMap.set(id, progress);
|
|
54
|
+
this.progress2Work.set(id, 0);
|
|
55
|
+
if (this.toDispose.disposed) {
|
|
56
|
+
this.$stopProgress(id);
|
|
57
|
+
} else {
|
|
58
|
+
this.toDispose.push(Disposable.create(() => this.$stopProgress(id)));
|
|
59
|
+
}
|
|
60
|
+
return id;
|
|
61
|
+
}
|
|
62
|
+
protected mapOptions(options: NotificationMain.StartProgressOptions): ProgressMessage {
|
|
63
|
+
const { title, location, cancellable } = options;
|
|
64
|
+
return { text: title, options: { location, cancelable: cancellable } };
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
$stopProgress(id: string): void {
|
|
68
|
+
const progress = this.progressMap.get(id);
|
|
69
|
+
|
|
70
|
+
if (progress) {
|
|
71
|
+
this.progressMap.delete(id);
|
|
72
|
+
this.progress2Work.delete(id);
|
|
73
|
+
progress.cancel();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
$updateProgress(id: string, item: NotificationMain.ProgressReport): void {
|
|
78
|
+
const progress = this.progressMap.get(id);
|
|
79
|
+
if (!progress) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const done = Math.min((this.progress2Work.get(id) || 0) + (item.increment || 0), 100);
|
|
83
|
+
this.progress2Work.set(id, done);
|
|
84
|
+
progress.report({ message: item.message, work: done ? { done, total: 100 } : undefined });
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2018 Red Hat, Inc. 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 { interfaces } from '@theia/core/shared/inversify';
|
|
18
|
+
import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
|
|
19
|
+
import { RPCProtocol } from '../../common/rpc-protocol';
|
|
20
|
+
import { EnvMain } from '../../common/plugin-api-rpc';
|
|
21
|
+
import { isWindows, isOSX } from '@theia/core';
|
|
22
|
+
import { OperatingSystem } from '../../plugin/types-impl';
|
|
23
|
+
|
|
24
|
+
export class EnvMainImpl implements EnvMain {
|
|
25
|
+
private envVariableServer: EnvVariablesServer;
|
|
26
|
+
|
|
27
|
+
constructor(rpc: RPCProtocol, container: interfaces.Container) {
|
|
28
|
+
this.envVariableServer = container.get(EnvVariablesServer);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
$getEnvVariable(envVarName: string): Promise<string | undefined> {
|
|
32
|
+
return this.envVariableServer.getValue(envVarName).then(result => result ? result.value : undefined);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async $getClientOperatingSystem(): Promise<OperatingSystem> {
|
|
36
|
+
if (isWindows) {
|
|
37
|
+
return OperatingSystem.Windows;
|
|
38
|
+
}
|
|
39
|
+
if (isOSX) {
|
|
40
|
+
return OperatingSystem.OSX;
|
|
41
|
+
}
|
|
42
|
+
return OperatingSystem.Linux;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -28,7 +28,7 @@ import { PluginCliContribution } from '../plugin-cli-contribution';
|
|
|
28
28
|
import { getTempDirPathAsync } from '../temp-dir-util';
|
|
29
29
|
|
|
30
30
|
@injectable()
|
|
31
|
-
export class
|
|
31
|
+
export abstract class AbstractPluginDirectoryHandler implements PluginDeployerDirectoryHandler {
|
|
32
32
|
|
|
33
33
|
protected readonly deploymentDirectory: Deferred<URI>;
|
|
34
34
|
|
|
@@ -42,15 +42,20 @@ export class PluginTheiaDirectoryHandler implements PluginDeployerDirectoryHandl
|
|
|
42
42
|
|
|
43
43
|
async accept(resolvedPlugin: PluginDeployerEntry): Promise<boolean> {
|
|
44
44
|
|
|
45
|
-
console.debug(
|
|
45
|
+
console.debug(`Plugin directory handler: accepting plugin with path ${resolvedPlugin.path()}`);
|
|
46
46
|
|
|
47
47
|
// handle only directories
|
|
48
48
|
if (await resolvedPlugin.isFile()) {
|
|
49
49
|
return false;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
// Was this directory unpacked from an NPM tarball?
|
|
53
|
+
const wasTarball = resolvedPlugin.originalPath().endsWith('.tgz');
|
|
54
|
+
const rootPath = resolvedPlugin.path();
|
|
55
|
+
const basePath = wasTarball ? path.resolve(rootPath, 'package') : rootPath;
|
|
56
|
+
|
|
52
57
|
// is there a package.json ?
|
|
53
|
-
const packageJsonPath = path.resolve(
|
|
58
|
+
const packageJsonPath = path.resolve(basePath, 'package.json');
|
|
54
59
|
|
|
55
60
|
try {
|
|
56
61
|
let packageJson = resolvedPlugin.getValue<PluginPackage>('package.json');
|
|
@@ -60,26 +65,20 @@ export class PluginTheiaDirectoryHandler implements PluginDeployerDirectoryHandl
|
|
|
60
65
|
resolvedPlugin.storeValue('package.json', packageJson);
|
|
61
66
|
}
|
|
62
67
|
|
|
63
|
-
if (packageJson
|
|
68
|
+
if (this.acceptManifest(packageJson)) {
|
|
69
|
+
if (wasTarball) {
|
|
70
|
+
resolvedPlugin.updatePath(basePath);
|
|
71
|
+
resolvedPlugin.rootPath = rootPath;
|
|
72
|
+
}
|
|
64
73
|
return true;
|
|
65
74
|
}
|
|
66
75
|
} catch { /* Failed to read file. Fall through. */ }
|
|
67
76
|
return false;
|
|
68
77
|
}
|
|
69
78
|
|
|
70
|
-
|
|
71
|
-
await this.copyDirectory(context);
|
|
72
|
-
const types: PluginDeployerEntryType[] = [];
|
|
73
|
-
const packageJson = context.pluginEntry().getValue<PluginPackage>('package.json');
|
|
74
|
-
if (packageJson.theiaPlugin && packageJson.theiaPlugin.backend) {
|
|
75
|
-
types.push(PluginDeployerEntryType.BACKEND);
|
|
76
|
-
}
|
|
77
|
-
if (packageJson.theiaPlugin && packageJson.theiaPlugin.frontend) {
|
|
78
|
-
types.push(PluginDeployerEntryType.FRONTEND);
|
|
79
|
-
}
|
|
79
|
+
protected abstract acceptManifest(plugin: PluginPackage): boolean;
|
|
80
80
|
|
|
81
|
-
|
|
82
|
-
}
|
|
81
|
+
abstract handle(context: PluginDeployerDirectoryHandlerContext): Promise<void>;
|
|
83
82
|
|
|
84
83
|
protected async copyDirectory(context: PluginDeployerDirectoryHandlerContext): Promise<void> {
|
|
85
84
|
if (this.pluginCli.copyUncompressedPlugins() && context.pluginEntry().type === PluginType.User) {
|
|
@@ -112,4 +111,27 @@ export class PluginTheiaDirectoryHandler implements PluginDeployerDirectoryHandl
|
|
|
112
111
|
const deploymentDirectory = await this.deploymentDirectory.promise;
|
|
113
112
|
return FileUri.fsPath(deploymentDirectory.resolve(filenamify(context.pluginEntry().id(), { replacement: '_' })));
|
|
114
113
|
}
|
|
114
|
+
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
@injectable()
|
|
118
|
+
export class PluginTheiaDirectoryHandler extends AbstractPluginDirectoryHandler {
|
|
119
|
+
|
|
120
|
+
protected acceptManifest(plugin: PluginPackage): boolean {
|
|
121
|
+
return plugin?.engines?.theiaPlugin !== undefined;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
async handle(context: PluginDeployerDirectoryHandlerContext): Promise<void> {
|
|
125
|
+
await this.copyDirectory(context);
|
|
126
|
+
const types: PluginDeployerEntryType[] = [];
|
|
127
|
+
const packageJson = context.pluginEntry().getValue<PluginPackage>('package.json');
|
|
128
|
+
if (packageJson.theiaPlugin && packageJson.theiaPlugin.backend) {
|
|
129
|
+
types.push(PluginDeployerEntryType.BACKEND);
|
|
130
|
+
}
|
|
131
|
+
if (packageJson.theiaPlugin && packageJson.theiaPlugin.frontend) {
|
|
132
|
+
types.push(PluginDeployerEntryType.FRONTEND);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
context.pluginEntry().accept(...types);
|
|
136
|
+
}
|
|
115
137
|
}
|
|
@@ -21,7 +21,7 @@ import { Deferred } from '@theia/core/lib/common/promise-util';
|
|
|
21
21
|
import { getTempDirPathAsync } from '../temp-dir-util';
|
|
22
22
|
import * as fs from '@theia/core/shared/fs-extra';
|
|
23
23
|
import * as filenamify from 'filenamify';
|
|
24
|
-
import { FileUri } from '@theia/core/lib/
|
|
24
|
+
import { FileUri } from '@theia/core/lib/common/file-uri';
|
|
25
25
|
import { PluginTheiaEnvironment } from '../../common/plugin-theia-environment';
|
|
26
26
|
|
|
27
27
|
@injectable()
|
|
@@ -271,20 +271,24 @@ export class PluginDeployerImpl implements PluginDeployer {
|
|
|
271
271
|
const acceptedPlugins = pluginsToDeploy.filter(pluginDeployerEntry => pluginDeployerEntry.isAccepted());
|
|
272
272
|
const acceptedFrontendPlugins = pluginsToDeploy.filter(pluginDeployerEntry => pluginDeployerEntry.isAccepted(PluginDeployerEntryType.FRONTEND));
|
|
273
273
|
const acceptedBackendPlugins = pluginsToDeploy.filter(pluginDeployerEntry => pluginDeployerEntry.isAccepted(PluginDeployerEntryType.BACKEND));
|
|
274
|
+
const acceptedHeadlessPlugins = pluginsToDeploy.filter(pluginDeployerEntry => pluginDeployerEntry.isAccepted(PluginDeployerEntryType.HEADLESS));
|
|
274
275
|
|
|
275
276
|
this.logger.debug('the accepted plugins are', acceptedPlugins);
|
|
276
277
|
this.logger.debug('the acceptedFrontendPlugins plugins are', acceptedFrontendPlugins);
|
|
277
278
|
this.logger.debug('the acceptedBackendPlugins plugins are', acceptedBackendPlugins);
|
|
279
|
+
this.logger.debug('the acceptedHeadlessPlugins plugins are', acceptedHeadlessPlugins);
|
|
278
280
|
|
|
279
281
|
acceptedPlugins.forEach(plugin => {
|
|
280
282
|
this.logger.debug('will deploy plugin', plugin.id(), 'with changes', JSON.stringify(plugin.getChanges()), 'and this plugin has been resolved by', plugin.resolvedBy());
|
|
281
283
|
});
|
|
282
284
|
|
|
283
285
|
// local path to launch
|
|
284
|
-
const pluginPaths = acceptedBackendPlugins.map(pluginEntry => pluginEntry.path());
|
|
286
|
+
const pluginPaths = [...acceptedBackendPlugins, ...acceptedHeadlessPlugins].map(pluginEntry => pluginEntry.path());
|
|
285
287
|
this.logger.debug('local path to deploy on remote instance', pluginPaths);
|
|
286
288
|
|
|
287
289
|
const deployments = await Promise.all([
|
|
290
|
+
// headless plugins are deployed like backend plugins
|
|
291
|
+
this.pluginDeployerHandler.deployBackendPlugins(acceptedHeadlessPlugins),
|
|
288
292
|
// start the backend plugins
|
|
289
293
|
this.pluginDeployerHandler.deployBackendPlugins(acceptedBackendPlugins),
|
|
290
294
|
this.pluginDeployerHandler.deployFrontendPlugins(acceptedFrontendPlugins)
|
|
@@ -18,7 +18,7 @@ import { injectable, inject, postConstruct } from '@theia/core/shared/inversify'
|
|
|
18
18
|
import { FileSystemLocking } from '@theia/core/lib/node';
|
|
19
19
|
import * as fs from '@theia/core/shared/fs-extra';
|
|
20
20
|
import * as path from 'path';
|
|
21
|
-
import { FileUri } from '@theia/core/lib/
|
|
21
|
+
import { FileUri } from '@theia/core/lib/common/file-uri';
|
|
22
22
|
import { Deferred } from '@theia/core/lib/common/promise-util';
|
|
23
23
|
import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
|
|
24
24
|
import { PluginPaths } from './paths/const';
|
|
@@ -15,15 +15,21 @@
|
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
17
|
import * as theia from '@theia/plugin';
|
|
18
|
+
import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
18
19
|
import { RPCProtocol } from '../common/rpc-protocol';
|
|
19
20
|
import { PLUGIN_RPC_CONTEXT, ClipboardMain } from '../common';
|
|
20
21
|
|
|
22
|
+
@injectable()
|
|
21
23
|
export class ClipboardExt implements theia.Clipboard {
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
@inject(RPCProtocol)
|
|
26
|
+
protected readonly rpc: RPCProtocol;
|
|
24
27
|
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
protected proxy: ClipboardMain;
|
|
29
|
+
|
|
30
|
+
@postConstruct()
|
|
31
|
+
initialize(): void {
|
|
32
|
+
this.proxy = this.rpc.getProxy(PLUGIN_RPC_CONTEXT.CLIPBOARD_MAIN);
|
|
27
33
|
}
|
|
28
34
|
|
|
29
35
|
readText(): Promise<string> {
|
|
@@ -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
|
+
import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
16
17
|
import { Emitter } from '@theia/core/lib/common/event';
|
|
17
18
|
import { Path } from '@theia/core/lib/common/path';
|
|
18
19
|
import * as theia from '@theia/plugin';
|
|
@@ -43,7 +44,11 @@ interface ConfigurationProviderRecord {
|
|
|
43
44
|
|
|
44
45
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
45
46
|
|
|
47
|
+
@injectable()
|
|
46
48
|
export class DebugExtImpl implements DebugExt {
|
|
49
|
+
@inject(RPCProtocol)
|
|
50
|
+
protected readonly rpc: RPCProtocol;
|
|
51
|
+
|
|
47
52
|
// debug sessions by sessionId
|
|
48
53
|
private sessions = new Map<string, PluginDebugAdapterSession>();
|
|
49
54
|
private configurationProviderHandleGenerator: number;
|
|
@@ -83,8 +88,7 @@ export class DebugExtImpl implements DebugExt {
|
|
|
83
88
|
return [...this._breakpoints.values()];
|
|
84
89
|
}
|
|
85
90
|
|
|
86
|
-
constructor(
|
|
87
|
-
this.proxy = rpc.getProxy(Ext.DEBUG_MAIN);
|
|
91
|
+
constructor() {
|
|
88
92
|
this.activeDebugConsole = {
|
|
89
93
|
append: (value: string) => this.proxy.$appendToDebugConsole(value),
|
|
90
94
|
appendLine: (value: string) => this.proxy.$appendLineToDebugConsole(value)
|
|
@@ -93,6 +97,11 @@ export class DebugExtImpl implements DebugExt {
|
|
|
93
97
|
this.configurationProviders = [];
|
|
94
98
|
}
|
|
95
99
|
|
|
100
|
+
@postConstruct()
|
|
101
|
+
initialize(): void {
|
|
102
|
+
this.proxy = this.rpc.getProxy(Ext.DEBUG_MAIN);
|
|
103
|
+
}
|
|
104
|
+
|
|
96
105
|
/**
|
|
97
106
|
* Sets dependencies.
|
|
98
107
|
*/
|
package/src/plugin/documents.ts
CHANGED
|
@@ -158,7 +158,7 @@ export class DocumentsExtImpl implements DocumentsExt {
|
|
|
158
158
|
const uriString = uri.toString();
|
|
159
159
|
const data = this.editorsAndDocuments.getDocument(uriString);
|
|
160
160
|
if (!data) {
|
|
161
|
-
throw new Error('unknown document');
|
|
161
|
+
throw new Error('unknown document: ' + uriString);
|
|
162
162
|
}
|
|
163
163
|
data.acceptIsDirty(isDirty);
|
|
164
164
|
this._onDidChangeDocument.fire({
|
|
@@ -172,7 +172,7 @@ export class DocumentsExtImpl implements DocumentsExt {
|
|
|
172
172
|
const uriString = uri.toString();
|
|
173
173
|
const data = this.editorsAndDocuments.getDocument(uriString);
|
|
174
174
|
if (!data) {
|
|
175
|
-
throw new Error('unknown document');
|
|
175
|
+
throw new Error('unknown document: ' + uriString);
|
|
176
176
|
}
|
|
177
177
|
data.acceptIsDirty(isDirty);
|
|
178
178
|
data.onEvents(e);
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
|
+
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
17
18
|
import { EditorsAndDocumentsExt, EditorsAndDocumentsDelta, PLUGIN_RPC_CONTEXT } from '../common/plugin-api-rpc';
|
|
18
19
|
import { TextEditorExt } from './text-editor';
|
|
19
20
|
import { RPCProtocol } from '../common/rpc-protocol';
|
|
@@ -24,7 +25,11 @@ import * as Converter from './type-converters';
|
|
|
24
25
|
import { dispose } from '../common/disposable-util';
|
|
25
26
|
import { URI } from './types-impl';
|
|
26
27
|
|
|
28
|
+
@injectable()
|
|
27
29
|
export class EditorsAndDocumentsExtImpl implements EditorsAndDocumentsExt {
|
|
30
|
+
@inject(RPCProtocol)
|
|
31
|
+
protected readonly rpc: RPCProtocol;
|
|
32
|
+
|
|
28
33
|
private activeEditorId: string | null = null;
|
|
29
34
|
|
|
30
35
|
private readonly _onDidAddDocuments = new Emitter<DocumentDataExt[]>();
|
|
@@ -40,9 +45,6 @@ export class EditorsAndDocumentsExtImpl implements EditorsAndDocumentsExt {
|
|
|
40
45
|
private readonly documents = new Map<string, DocumentDataExt>();
|
|
41
46
|
private readonly editors = new Map<string, TextEditorExt>();
|
|
42
47
|
|
|
43
|
-
constructor(private readonly rpc: RPCProtocol) {
|
|
44
|
-
}
|
|
45
|
-
|
|
46
48
|
async $acceptEditorsAndDocumentsDelta(delta: EditorsAndDocumentsDelta): Promise<void> {
|
|
47
49
|
const removedDocuments = new Array<DocumentDataExt>();
|
|
48
50
|
const addedDocuments = new Array<DocumentDataExt>();
|
package/src/plugin/env.ts
CHANGED
|
@@ -14,13 +14,18 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
|
+
import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
17
18
|
import * as theia from '@theia/plugin';
|
|
18
19
|
import { RPCProtocol } from '../common/rpc-protocol';
|
|
19
20
|
import { EnvMain, PLUGIN_RPC_CONTEXT } from '../common/plugin-api-rpc';
|
|
20
21
|
import { QueryParameters } from '../common/env';
|
|
21
22
|
import { v4 } from 'uuid';
|
|
22
23
|
|
|
24
|
+
@injectable()
|
|
23
25
|
export abstract class EnvExtImpl {
|
|
26
|
+
@inject(RPCProtocol)
|
|
27
|
+
protected readonly rpc: RPCProtocol;
|
|
28
|
+
|
|
24
29
|
private proxy: EnvMain;
|
|
25
30
|
private queryParameters: QueryParameters;
|
|
26
31
|
private lang: string;
|
|
@@ -29,15 +34,20 @@ export abstract class EnvExtImpl {
|
|
|
29
34
|
private envMachineId: string;
|
|
30
35
|
private envSessionId: string;
|
|
31
36
|
private host: string;
|
|
37
|
+
private applicationRoot: string;
|
|
32
38
|
private _remoteName: string | undefined;
|
|
33
39
|
|
|
34
|
-
constructor(
|
|
35
|
-
this.proxy = rpc.getProxy(PLUGIN_RPC_CONTEXT.ENV_MAIN);
|
|
40
|
+
constructor() {
|
|
36
41
|
this.envSessionId = v4();
|
|
37
42
|
this.envMachineId = v4();
|
|
38
43
|
this._remoteName = undefined;
|
|
39
44
|
}
|
|
40
45
|
|
|
46
|
+
@postConstruct()
|
|
47
|
+
initialize(): void {
|
|
48
|
+
this.proxy = this.rpc.getProxy(PLUGIN_RPC_CONTEXT.ENV_MAIN);
|
|
49
|
+
}
|
|
50
|
+
|
|
41
51
|
getEnvVariable(envVarName: string): Promise<string | undefined> {
|
|
42
52
|
return this.proxy.$getEnvVariable(envVarName).then(x => {
|
|
43
53
|
if (x === null) {
|
|
@@ -75,6 +85,10 @@ export abstract class EnvExtImpl {
|
|
|
75
85
|
this.host = appHost;
|
|
76
86
|
}
|
|
77
87
|
|
|
88
|
+
setAppRoot(appRoot: string): void {
|
|
89
|
+
this.applicationRoot = appRoot;
|
|
90
|
+
}
|
|
91
|
+
|
|
78
92
|
getClientOperatingSystem(): Promise<theia.OperatingSystem> {
|
|
79
93
|
return this.proxy.$getClientOperatingSystem();
|
|
80
94
|
}
|
|
@@ -83,7 +97,9 @@ export abstract class EnvExtImpl {
|
|
|
83
97
|
return this.applicationName;
|
|
84
98
|
}
|
|
85
99
|
|
|
86
|
-
|
|
100
|
+
get appRoot(): string {
|
|
101
|
+
return this.applicationRoot;
|
|
102
|
+
}
|
|
87
103
|
|
|
88
104
|
abstract get isNewAppInstall(): boolean;
|
|
89
105
|
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
18
18
|
|
|
19
|
+
import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
19
20
|
import { nls } from '@theia/core';
|
|
20
21
|
import { Localization } from '@theia/core/lib/common/i18n/localization';
|
|
21
22
|
import { LocalizationExt, LocalizationMain, Plugin, PLUGIN_RPC_CONTEXT, StringDetails } from '../common';
|
|
@@ -23,15 +24,19 @@ import { LanguagePackBundle } from '../common/language-pack-service';
|
|
|
23
24
|
import { RPCProtocol } from '../common/rpc-protocol';
|
|
24
25
|
import { URI } from './types-impl';
|
|
25
26
|
|
|
27
|
+
@injectable()
|
|
26
28
|
export class LocalizationExtImpl implements LocalizationExt {
|
|
29
|
+
@inject(RPCProtocol)
|
|
30
|
+
protected readonly rpc: RPCProtocol;
|
|
27
31
|
|
|
28
|
-
private
|
|
32
|
+
private _proxy: LocalizationMain;
|
|
29
33
|
private currentLanguage?: string;
|
|
30
34
|
private isDefaultLanguage = true;
|
|
31
35
|
private readonly bundleCache = new Map<string, LanguagePackBundle | undefined>();
|
|
32
36
|
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
@postConstruct()
|
|
38
|
+
initialize(): void {
|
|
39
|
+
this._proxy = this.rpc.getProxy(PLUGIN_RPC_CONTEXT.LOCALIZATION_MAIN);
|
|
35
40
|
}
|
|
36
41
|
|
|
37
42
|
translateMessage(pluginId: string, details: StringDetails): string {
|
|
@@ -13,18 +13,23 @@
|
|
|
13
13
|
//
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
|
+
import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
16
17
|
import {
|
|
17
18
|
PLUGIN_RPC_CONTEXT as Ext, MessageRegistryMain, MainMessageOptions, MainMessageType
|
|
18
19
|
} from '../common/plugin-api-rpc';
|
|
19
20
|
import { RPCProtocol } from '../common/rpc-protocol';
|
|
20
21
|
import { MessageItem, MessageOptions } from '@theia/plugin';
|
|
21
22
|
|
|
23
|
+
@injectable()
|
|
22
24
|
export class MessageRegistryExt {
|
|
25
|
+
@inject(RPCProtocol)
|
|
26
|
+
protected readonly rpc: RPCProtocol;
|
|
23
27
|
|
|
24
28
|
private proxy: MessageRegistryMain;
|
|
25
29
|
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
@postConstruct()
|
|
31
|
+
initialize(): void {
|
|
32
|
+
this.proxy = this.rpc.getProxy(Ext.MESSAGE_REGISTRY_MAIN);
|
|
28
33
|
}
|
|
29
34
|
|
|
30
35
|
async showMessage(type: MainMessageType, message: string,
|
|
@@ -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
|
+
import { Container } from '@theia/core/shared/inversify';
|
|
16
17
|
import { DebugSession } from '@theia/plugin';
|
|
17
18
|
import * as chai from 'chai';
|
|
18
19
|
import { ProxyIdentifier, RPCProtocol } from '../../../common/rpc-protocol';
|
|
@@ -37,7 +38,10 @@ describe('Debug API', () => {
|
|
|
37
38
|
}
|
|
38
39
|
};
|
|
39
40
|
|
|
40
|
-
const
|
|
41
|
+
const container = new Container();
|
|
42
|
+
container.bind(RPCProtocol).toConstantValue(mockRPCProtocol);
|
|
43
|
+
container.bind(DebugExtImpl).toSelf().inSingletonScope();
|
|
44
|
+
const debug = container.get(DebugExtImpl);
|
|
41
45
|
|
|
42
46
|
it('should use sourceReference, path and sessionId', () => {
|
|
43
47
|
const source = {
|
|
@@ -14,9 +14,9 @@
|
|
|
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
18
|
import * as mac from 'macaddress';
|
|
18
19
|
import { EnvExtImpl } from '../env';
|
|
19
|
-
import { RPCProtocol } from '../../common/rpc-protocol';
|
|
20
20
|
import { createHash } from 'crypto';
|
|
21
21
|
import { v4 } from 'uuid';
|
|
22
22
|
import fs = require('fs');
|
|
@@ -25,13 +25,15 @@ import fs = require('fs');
|
|
|
25
25
|
* Provides machineId using mac address. It's only possible on node side
|
|
26
26
|
* Extending the common class
|
|
27
27
|
*/
|
|
28
|
+
@injectable()
|
|
28
29
|
export class EnvNodeExtImpl extends EnvExtImpl {
|
|
29
30
|
|
|
30
31
|
private macMachineId: string;
|
|
31
32
|
private _isNewAppInstall: boolean;
|
|
32
33
|
|
|
33
|
-
constructor(
|
|
34
|
-
super(
|
|
34
|
+
constructor() {
|
|
35
|
+
super();
|
|
36
|
+
|
|
35
37
|
mac.one((err, macAddress) => {
|
|
36
38
|
if (err) {
|
|
37
39
|
this.macMachineId = v4();
|
|
@@ -49,13 +51,6 @@ export class EnvNodeExtImpl extends EnvExtImpl {
|
|
|
49
51
|
return this.macMachineId;
|
|
50
52
|
}
|
|
51
53
|
|
|
52
|
-
/**
|
|
53
|
-
* Provides application root.
|
|
54
|
-
*/
|
|
55
|
-
get appRoot(): string {
|
|
56
|
-
return __dirname;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
54
|
get isNewAppInstall(): boolean {
|
|
60
55
|
return this._isNewAppInstall;
|
|
61
56
|
}
|