@theia/plugin-ext 1.27.0-next.9 → 1.27.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/connection.d.ts +3 -3
- package/lib/common/connection.d.ts.map +1 -1
- package/lib/common/connection.js +0 -1
- package/lib/common/connection.js.map +1 -1
- package/lib/common/plugin-api-rpc.d.ts +18 -8
- package/lib/common/plugin-api-rpc.d.ts.map +1 -1
- package/lib/common/plugin-api-rpc.js.map +1 -1
- package/lib/common/plugin-identifiers.d.ts +41 -0
- package/lib/common/plugin-identifiers.d.ts.map +1 -0
- package/lib/common/plugin-identifiers.js +81 -0
- package/lib/common/plugin-identifiers.js.map +1 -0
- package/lib/common/plugin-protocol.d.ts +50 -11
- package/lib/common/plugin-protocol.d.ts.map +1 -1
- package/lib/common/plugin-protocol.js +3 -1
- package/lib/common/plugin-protocol.js.map +1 -1
- package/lib/hosted/browser/hosted-plugin.d.ts +2 -2
- package/lib/hosted/browser/hosted-plugin.d.ts.map +1 -1
- package/lib/hosted/browser/hosted-plugin.js +26 -18
- package/lib/hosted/browser/hosted-plugin.js.map +1 -1
- package/lib/hosted/browser/worker/debug-stub.d.ts +1 -1
- package/lib/hosted/browser/worker/debug-stub.d.ts.map +1 -1
- package/lib/hosted/browser/worker/debug-stub.js +2 -2
- package/lib/hosted/browser/worker/debug-stub.js.map +1 -1
- package/lib/hosted/browser/worker/plugin-manifest-loader.d.ts.map +1 -1
- package/lib/hosted/browser/worker/plugin-manifest-loader.js +4 -1
- package/lib/hosted/browser/worker/plugin-manifest-loader.js.map +1 -1
- package/lib/hosted/node/hosted-plugin-deployer-handler.d.ts +17 -9
- package/lib/hosted/node/hosted-plugin-deployer-handler.d.ts.map +1 -1
- package/lib/hosted/node/hosted-plugin-deployer-handler.js +99 -18
- package/lib/hosted/node/hosted-plugin-deployer-handler.js.map +1 -1
- package/lib/hosted/node/hosted-plugin-localization-service.d.ts.map +1 -1
- package/lib/hosted/node/hosted-plugin-localization-service.js +2 -4
- package/lib/hosted/node/hosted-plugin-localization-service.js.map +1 -1
- 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.map +1 -1
- package/lib/hosted/node/hosted-plugin.d.ts +2 -2
- package/lib/hosted/node/hosted-plugin.d.ts.map +1 -1
- package/lib/hosted/node/hosted-plugin.js.map +1 -1
- package/lib/hosted/node/metadata-scanner.d.ts +3 -2
- package/lib/hosted/node/metadata-scanner.d.ts.map +1 -1
- package/lib/hosted/node/metadata-scanner.js +8 -3
- package/lib/hosted/node/metadata-scanner.js.map +1 -1
- package/lib/hosted/node/plugin-host-rpc.js +2 -2
- package/lib/hosted/node/plugin-host-rpc.js.map +1 -1
- package/lib/hosted/node/plugin-manifest-loader.d.ts.map +1 -1
- package/lib/hosted/node/plugin-manifest-loader.js +3 -0
- package/lib/hosted/node/plugin-manifest-loader.js.map +1 -1
- package/lib/hosted/node/plugin-service.d.ts +18 -4
- package/lib/hosted/node/plugin-service.d.ts.map +1 -1
- package/lib/hosted/node/plugin-service.js +73 -18
- package/lib/hosted/node/plugin-service.js.map +1 -1
- package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
- package/lib/hosted/node/scanners/scanner-theia.js +6 -3
- package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
- package/lib/main/browser/custom-editors/custom-editor-opener.d.ts.map +1 -1
- package/lib/main/browser/custom-editors/custom-editor-opener.js +2 -2
- package/lib/main/browser/custom-editors/custom-editor-opener.js.map +1 -1
- package/lib/main/browser/debug/plugin-debug-session-factory.d.ts +3 -3
- package/lib/main/browser/debug/plugin-debug-session-factory.d.ts.map +1 -1
- package/lib/main/browser/debug/plugin-debug-session-factory.js.map +1 -1
- package/lib/main/browser/documents-main.d.ts +1 -2
- package/lib/main/browser/documents-main.d.ts.map +1 -1
- package/lib/main/browser/documents-main.js +26 -6
- package/lib/main/browser/documents-main.js.map +1 -1
- package/lib/main/browser/editors-and-documents-main.d.ts +2 -0
- package/lib/main/browser/editors-and-documents-main.d.ts.map +1 -1
- package/lib/main/browser/editors-and-documents-main.js +14 -2
- package/lib/main/browser/editors-and-documents-main.js.map +1 -1
- package/lib/main/browser/languages-main.d.ts.map +1 -1
- package/lib/main/browser/languages-main.js +2 -1
- package/lib/main/browser/languages-main.js.map +1 -1
- package/lib/main/browser/main-context.d.ts.map +1 -1
- package/lib/main/browser/main-context.js +5 -4
- package/lib/main/browser/main-context.js.map +1 -1
- package/lib/main/browser/plugin-contribution-handler.d.ts +2 -0
- package/lib/main/browser/plugin-contribution-handler.d.ts.map +1 -1
- package/lib/main/browser/plugin-contribution-handler.js +36 -1
- package/lib/main/browser/plugin-contribution-handler.js.map +1 -1
- package/lib/main/browser/plugin-shared-style.d.ts +4 -2
- package/lib/main/browser/plugin-shared-style.d.ts.map +1 -1
- package/lib/main/browser/plugin-shared-style.js +15 -4
- package/lib/main/browser/plugin-shared-style.js.map +1 -1
- package/lib/main/browser/text-editors-main.d.ts +6 -3
- package/lib/main/browser/text-editors-main.d.ts.map +1 -1
- package/lib/main/browser/text-editors-main.js +8 -1
- package/lib/main/browser/text-editors-main.js.map +1 -1
- package/lib/main/browser/theming-main.d.ts +2 -1
- package/lib/main/browser/theming-main.d.ts.map +1 -1
- package/lib/main/browser/theming-main.js +3 -6
- package/lib/main/browser/theming-main.js.map +1 -1
- package/lib/main/browser/view/plugin-tree-view-node-label-provider.d.ts.map +1 -1
- package/lib/main/browser/view/plugin-tree-view-node-label-provider.js +7 -5
- package/lib/main/browser/view/plugin-tree-view-node-label-provider.js.map +1 -1
- package/lib/main/browser/view/plugin-view-registry.d.ts +1 -1
- package/lib/main/browser/view/plugin-view-registry.d.ts.map +1 -1
- package/lib/main/browser/view/plugin-view-registry.js +11 -6
- package/lib/main/browser/view/plugin-view-registry.js.map +1 -1
- package/lib/main/browser/view/tree-view-widget.d.ts +10 -5
- package/lib/main/browser/view/tree-view-widget.d.ts.map +1 -1
- package/lib/main/browser/view/tree-view-widget.js +40 -14
- package/lib/main/browser/view/tree-view-widget.js.map +1 -1
- package/lib/main/browser/webview/webview-theme-data-provider.d.ts +3 -1
- package/lib/main/browser/webview/webview-theme-data-provider.d.ts.map +1 -1
- package/lib/main/browser/webview/webview-theme-data-provider.js +5 -1
- package/lib/main/browser/webview/webview-theme-data-provider.js.map +1 -1
- package/lib/main/node/handlers/plugin-theia-directory-handler.d.ts +6 -1
- package/lib/main/node/handlers/plugin-theia-directory-handler.d.ts.map +1 -1
- package/lib/main/node/handlers/plugin-theia-directory-handler.js +61 -20
- package/lib/main/node/handlers/plugin-theia-directory-handler.js.map +1 -1
- package/lib/main/node/handlers/plugin-theia-file-handler.d.ts +4 -0
- package/lib/main/node/handlers/plugin-theia-file-handler.d.ts.map +1 -1
- package/lib/main/node/handlers/plugin-theia-file-handler.js +26 -4
- package/lib/main/node/handlers/plugin-theia-file-handler.js.map +1 -1
- package/lib/main/node/plugin-cli-contribution.d.ts +3 -0
- package/lib/main/node/plugin-cli-contribution.d.ts.map +1 -1
- package/lib/main/node/plugin-cli-contribution.js +13 -0
- package/lib/main/node/plugin-cli-contribution.js.map +1 -1
- package/lib/main/node/plugin-deployer-directory-handler-context-impl.d.ts +1 -0
- package/lib/main/node/plugin-deployer-directory-handler-context-impl.d.ts.map +1 -1
- package/lib/main/node/plugin-deployer-directory-handler-context-impl.js +17 -0
- package/lib/main/node/plugin-deployer-directory-handler-context-impl.js.map +1 -1
- package/lib/main/node/plugin-deployer-file-handler-context-impl.d.ts.map +1 -1
- package/lib/main/node/plugin-deployer-file-handler-context-impl.js +0 -1
- package/lib/main/node/plugin-deployer-file-handler-context-impl.js.map +1 -1
- package/lib/main/node/plugin-deployer-impl.d.ts +10 -7
- package/lib/main/node/plugin-deployer-impl.d.ts.map +1 -1
- package/lib/main/node/plugin-deployer-impl.js +84 -38
- package/lib/main/node/plugin-deployer-impl.js.map +1 -1
- package/lib/main/node/plugin-ext-backend-module.d.ts.map +1 -1
- package/lib/main/node/plugin-ext-backend-module.js +2 -0
- package/lib/main/node/plugin-ext-backend-module.js.map +1 -1
- package/lib/main/node/plugin-server-handler.d.ts +5 -4
- package/lib/main/node/plugin-server-handler.d.ts.map +1 -1
- package/lib/main/node/plugin-server-handler.js +12 -5
- package/lib/main/node/plugin-server-handler.js.map +1 -1
- package/lib/main/node/plugin-uninstallation-manager.d.ts +15 -0
- package/lib/main/node/plugin-uninstallation-manager.d.ts.map +1 -0
- package/lib/main/node/plugin-uninstallation-manager.js +85 -0
- package/lib/main/node/plugin-uninstallation-manager.js.map +1 -0
- package/lib/plugin/{node/debug/debug.d.ts → debug/debug-ext.d.ts} +15 -13
- package/lib/plugin/debug/debug-ext.d.ts.map +1 -0
- package/lib/plugin/{node/debug/debug.js → debug/debug-ext.js} +17 -51
- package/lib/plugin/debug/debug-ext.js.map +1 -0
- package/lib/plugin/debug/plugin-debug-adapter-creator.d.ts +11 -0
- package/lib/plugin/debug/plugin-debug-adapter-creator.d.ts.map +1 -0
- package/lib/plugin/debug/plugin-debug-adapter-creator.js +42 -0
- package/lib/plugin/debug/plugin-debug-adapter-creator.js.map +1 -0
- package/lib/plugin/{node/debug → debug}/plugin-debug-adapter-session.d.ts +4 -4
- package/lib/plugin/debug/plugin-debug-adapter-session.d.ts.map +1 -0
- package/lib/plugin/{node/debug → debug}/plugin-debug-adapter-session.js +1 -1
- package/lib/plugin/debug/plugin-debug-adapter-session.js.map +1 -0
- package/lib/plugin/{node/debug → debug}/plugin-debug-adapter-tracker.d.ts +0 -0
- package/lib/plugin/debug/plugin-debug-adapter-tracker.d.ts.map +1 -0
- package/lib/plugin/{node/debug → debug}/plugin-debug-adapter-tracker.js +0 -0
- package/lib/plugin/debug/plugin-debug-adapter-tracker.js.map +1 -0
- package/lib/plugin/languages-utils.d.ts.map +1 -1
- package/lib/plugin/languages-utils.js +3 -2
- package/lib/plugin/languages-utils.js.map +1 -1
- package/lib/plugin/node/debug/plugin-node-debug-adapter-creator.d.ts +18 -0
- package/lib/plugin/node/debug/plugin-node-debug-adapter-creator.d.ts.map +1 -0
- package/lib/plugin/node/debug/plugin-node-debug-adapter-creator.js +155 -0
- package/lib/plugin/node/debug/plugin-node-debug-adapter-creator.js.map +1 -0
- package/lib/plugin/plugin-context.d.ts +1 -1
- package/lib/plugin/plugin-context.d.ts.map +1 -1
- package/lib/plugin/plugin-context.js +1 -2
- package/lib/plugin/plugin-context.js.map +1 -1
- package/lib/plugin/plugin-manager.d.ts.map +1 -1
- package/lib/plugin/plugin-manager.js +5 -9
- package/lib/plugin/plugin-manager.js.map +1 -1
- package/lib/plugin/text-editor.d.ts +2 -0
- package/lib/plugin/text-editor.d.ts.map +1 -1
- package/lib/plugin/text-editor.js +9 -0
- package/lib/plugin/text-editor.js.map +1 -1
- package/lib/plugin/theming.d.ts +1 -1
- package/lib/plugin/theming.d.ts.map +1 -1
- package/lib/plugin/tree/tree-views.d.ts +1 -0
- package/lib/plugin/tree/tree-views.d.ts.map +1 -1
- package/lib/plugin/tree/tree-views.js +10 -9
- package/lib/plugin/tree/tree-views.js.map +1 -1
- package/lib/plugin/types-impl.d.ts +1 -0
- package/lib/plugin/types-impl.d.ts.map +1 -1
- package/lib/plugin/types-impl.js +3 -2
- package/lib/plugin/types-impl.js.map +1 -1
- package/package.json +26 -25
- package/src/common/connection.ts +3 -4
- package/src/common/plugin-api-rpc.ts +20 -12
- package/src/common/plugin-identifiers.ts +84 -0
- package/src/common/plugin-protocol.ts +57 -12
- package/src/hosted/browser/hosted-plugin.ts +28 -21
- package/src/hosted/browser/worker/debug-stub.ts +1 -1
- package/src/hosted/browser/worker/plugin-manifest-loader.ts +4 -2
- package/src/hosted/node/hosted-plugin-deployer-handler.ts +109 -28
- package/src/hosted/node/hosted-plugin-localization-service.ts +4 -6
- package/src/hosted/node/hosted-plugin-process.ts +4 -4
- package/src/hosted/node/hosted-plugin.ts +2 -2
- package/src/hosted/node/metadata-scanner.ts +8 -6
- package/src/hosted/node/plugin-host-rpc.ts +2 -2
- package/src/hosted/node/plugin-manifest-loader.ts +2 -0
- package/src/hosted/node/plugin-service.ts +79 -23
- package/src/hosted/node/scanners/scanner-theia.ts +7 -4
- package/src/main/browser/custom-editors/custom-editor-opener.tsx +2 -2
- package/src/main/browser/debug/plugin-debug-session-factory.ts +2 -2
- package/src/main/browser/documents-main.ts +26 -8
- package/src/main/browser/editors-and-documents-main.ts +16 -2
- package/src/main/browser/languages-main.ts +2 -1
- package/src/main/browser/main-context.ts +4 -3
- package/src/main/browser/plugin-contribution-handler.ts +41 -3
- package/src/main/browser/plugin-icon-theme-service.ts +1 -1
- package/src/main/browser/plugin-shared-style.ts +9 -5
- package/src/main/browser/text-editors-main.ts +12 -2
- package/src/main/browser/theming-main.ts +3 -7
- package/src/main/browser/view/plugin-tree-view-node-label-provider.ts +7 -5
- package/src/main/browser/view/plugin-view-registry.ts +12 -7
- package/src/main/browser/view/tree-view-widget.tsx +45 -17
- package/src/main/browser/webview/webview-theme-data-provider.ts +7 -10
- package/src/main/node/handlers/plugin-theia-directory-handler.ts +56 -28
- package/src/main/node/handlers/plugin-theia-file-handler.ts +26 -4
- package/src/main/node/plugin-cli-contribution.ts +12 -0
- package/src/main/node/plugin-deployer-directory-handler-context-impl.ts +17 -1
- package/src/main/node/plugin-deployer-file-handler-context-impl.ts +0 -1
- package/src/main/node/plugin-deployer-impl.ts +88 -41
- package/src/main/node/plugin-ext-backend-module.ts +3 -0
- package/src/main/node/plugin-server-handler.ts +15 -7
- package/src/main/node/plugin-uninstallation-manager.ts +74 -0
- package/src/plugin/{node/debug/debug.ts → debug/debug-ext.ts} +25 -56
- package/src/plugin/debug/plugin-debug-adapter-creator.ts +50 -0
- package/src/plugin/{node/debug → debug}/plugin-debug-adapter-session.ts +4 -4
- package/src/plugin/{node/debug → debug}/plugin-debug-adapter-tracker.ts +0 -0
- package/src/plugin/languages-utils.ts +3 -2
- package/src/plugin/node/debug/plugin-node-debug-adapter-creator.ts +167 -0
- package/src/plugin/plugin-context.ts +2 -3
- package/src/plugin/plugin-manager.ts +5 -9
- package/src/plugin/text-editor.ts +16 -5
- package/src/plugin/theming.ts +1 -1
- package/src/plugin/tree/tree-views.ts +15 -12
- package/src/plugin/types-impl.ts +1 -1
- package/lib/main/browser/custom-editors/glob.d.ts +0 -51
- package/lib/main/browser/custom-editors/glob.d.ts.map +0 -1
- package/lib/main/browser/custom-editors/glob.js +0 -593
- package/lib/main/browser/custom-editors/glob.js.map +0 -1
- package/lib/main/browser/custom-editors/paths.d.ts +0 -25
- package/lib/main/browser/custom-editors/paths.d.ts.map +0 -1
- package/lib/main/browser/custom-editors/paths.js +0 -227
- package/lib/main/browser/custom-editors/paths.js.map +0 -1
- package/lib/main/browser/editor/untitled-resource.d.ts +0 -3
- package/lib/main/browser/editor/untitled-resource.d.ts.map +0 -1
- package/lib/main/browser/editor/untitled-resource.js +0 -24
- package/lib/main/browser/editor/untitled-resource.js.map +0 -1
- package/lib/plugin/node/debug/debug.d.ts.map +0 -1
- package/lib/plugin/node/debug/debug.js.map +0 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-executable-resolver.d.ts +0 -7
- package/lib/plugin/node/debug/plugin-debug-adapter-executable-resolver.d.ts.map +0 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-executable-resolver.js +0 -57
- package/lib/plugin/node/debug/plugin-debug-adapter-executable-resolver.js.map +0 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts.map +0 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-session.js.map +0 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-starter.d.ts +0 -15
- package/lib/plugin/node/debug/plugin-debug-adapter-starter.d.ts.map +0 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-starter.js +0 -85
- package/lib/plugin/node/debug/plugin-debug-adapter-starter.js.map +0 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-tracker.d.ts.map +0 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-tracker.js.map +0 -1
- package/lib/plugin/node/debug/plugin-inline-debug-adapter.d.ts +0 -19
- package/lib/plugin/node/debug/plugin-inline-debug-adapter.d.ts.map +0 -1
- package/lib/plugin/node/debug/plugin-inline-debug-adapter.js +0 -45
- package/lib/plugin/node/debug/plugin-inline-debug-adapter.js.map +0 -1
- package/src/main/browser/custom-editors/glob.ts +0 -743
- package/src/main/browser/custom-editors/paths.ts +0 -250
- package/src/main/browser/editor/untitled-resource.ts +0 -18
- package/src/plugin/node/debug/plugin-debug-adapter-executable-resolver.ts +0 -58
- package/src/plugin/node/debug/plugin-debug-adapter-starter.ts +0 -86
- package/src/plugin/node/debug/plugin-inline-debug-adapter.ts +0 -47
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2022 Ericsson 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
|
+
export namespace PluginIdentifiers {
|
|
18
|
+
export interface Components {
|
|
19
|
+
publisher?: string;
|
|
20
|
+
name: string;
|
|
21
|
+
version: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface IdAndVersion {
|
|
25
|
+
id: UnversionedId;
|
|
26
|
+
version: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type VersionedId = `${string}.${string}@${string}`;
|
|
30
|
+
export type UnversionedId = `${string}.${string}`;
|
|
31
|
+
/** Unpublished plugins (not from Open VSX or VSCode plugin store) may not have a `publisher` field. */
|
|
32
|
+
export const UNPUBLISHED = '<unpublished>';
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @returns a string in the format `<publisher>.<name>`
|
|
36
|
+
*/
|
|
37
|
+
export function componentsToUnversionedId({ publisher = UNPUBLISHED, name }: Components): UnversionedId {
|
|
38
|
+
return `${publisher.toLowerCase()}.${name.toLowerCase()}`;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @returns a string in the format `<publisher>.<name>@<version>`.
|
|
42
|
+
*/
|
|
43
|
+
export function componentsToVersionedId({ publisher = UNPUBLISHED, name, version }: Components): VersionedId {
|
|
44
|
+
return `${publisher.toLowerCase()}.${name.toLowerCase()}@${version}`;
|
|
45
|
+
}
|
|
46
|
+
export function componentsToVersionWithId(components: Components): IdAndVersion {
|
|
47
|
+
return { id: componentsToUnversionedId(components), version: components.version };
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* @returns a string in the format `<id>@<version>`.
|
|
51
|
+
*/
|
|
52
|
+
export function idAndVersionToVersionedId({ id, version }: IdAndVersion): VersionedId {
|
|
53
|
+
return `${id}@${version}`;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* @returns a string in the format `<publisher>.<name>`.
|
|
57
|
+
*/
|
|
58
|
+
export function unversionedFromVersioned(id: VersionedId): UnversionedId {
|
|
59
|
+
const endOfId = id.indexOf('@');
|
|
60
|
+
return id.slice(0, endOfId) as UnversionedId;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* @returns `undefined` if it looks like the string passed in does not have the format returned by {@link PluginIdentifiers.toVersionedId}.
|
|
64
|
+
*/
|
|
65
|
+
export function identifiersFromVersionedId(probablyId: string): Components | undefined {
|
|
66
|
+
const endOfPublisher = probablyId.indexOf('.');
|
|
67
|
+
const endOfName = probablyId.indexOf('@', endOfPublisher);
|
|
68
|
+
if (endOfPublisher === -1 || endOfName === -1) {
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
return { publisher: probablyId.slice(0, endOfPublisher), name: probablyId.slice(endOfPublisher + 1, endOfName), version: probablyId.slice(endOfName + 1) };
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* @returns `undefined` if it looks like the string passed in does not have the format returned by {@link PluginIdentifiers.toVersionedId}.
|
|
75
|
+
*/
|
|
76
|
+
export function idAndVersionFromVersionedId(probablyId: string): IdAndVersion | undefined {
|
|
77
|
+
const endOfPublisher = probablyId.indexOf('.');
|
|
78
|
+
const endOfName = probablyId.indexOf('@', endOfPublisher);
|
|
79
|
+
if (endOfPublisher === -1 || endOfName === -1) {
|
|
80
|
+
return undefined;
|
|
81
|
+
}
|
|
82
|
+
return { id: probablyId.slice(0, endOfName) as UnversionedId, version: probablyId.slice(endOfName + 1) };
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -25,7 +25,9 @@ import { PreferenceSchema, PreferenceSchemaProperties } from '@theia/core/lib/co
|
|
|
25
25
|
import { ProblemMatcherContribution, ProblemPatternContribution, TaskDefinition } from '@theia/task/lib/common';
|
|
26
26
|
import { ColorDefinition } from '@theia/core/lib/common/color';
|
|
27
27
|
import { ResourceLabelFormatter } from '@theia/core/lib/common/label-protocol';
|
|
28
|
+
import { PluginIdentifiers } from './plugin-identifiers';
|
|
28
29
|
|
|
30
|
+
export { PluginIdentifiers };
|
|
29
31
|
export const hostedServicePath = '/services/hostedPlugin';
|
|
30
32
|
|
|
31
33
|
/**
|
|
@@ -38,7 +40,8 @@ export type PluginEngine = string;
|
|
|
38
40
|
*/
|
|
39
41
|
export interface PluginPackage {
|
|
40
42
|
name: string;
|
|
41
|
-
publisher
|
|
43
|
+
// The publisher is not guaranteed to be defined for unpublished plugins. https://github.com/microsoft/vscode-vsce/commit/a38657ece04c20e4fbde15d5ac1ed39ca51cb856
|
|
44
|
+
publisher: string | undefined;
|
|
42
45
|
version: string;
|
|
43
46
|
engines: {
|
|
44
47
|
[type in PluginEngine]: string;
|
|
@@ -271,6 +274,7 @@ export interface PluginPackageLanguageContributionConfiguration {
|
|
|
271
274
|
wordPattern?: string;
|
|
272
275
|
indentationRules?: IndentationRules;
|
|
273
276
|
folding?: FoldingRules;
|
|
277
|
+
onEnterRules?: OnEnterRule[];
|
|
274
278
|
}
|
|
275
279
|
|
|
276
280
|
export interface PluginTaskDefinitionContribution {
|
|
@@ -339,7 +343,7 @@ export interface PluginDeployerResolver {
|
|
|
339
343
|
|
|
340
344
|
accept(pluginSourceId: string): boolean;
|
|
341
345
|
|
|
342
|
-
resolve(pluginResolverContext: PluginDeployerResolverContext): Promise<void>;
|
|
346
|
+
resolve(pluginResolverContext: PluginDeployerResolverContext, options?: PluginDeployOptions): Promise<void>;
|
|
343
347
|
|
|
344
348
|
}
|
|
345
349
|
|
|
@@ -486,6 +490,8 @@ export interface PluginDeployerFileHandlerContext {
|
|
|
486
490
|
|
|
487
491
|
export interface PluginDeployerDirectoryHandlerContext {
|
|
488
492
|
|
|
493
|
+
copy(origin: string, target: string): Promise<void>;
|
|
494
|
+
|
|
489
495
|
pluginEntry(): PluginDeployerEntry;
|
|
490
496
|
|
|
491
497
|
}
|
|
@@ -622,6 +628,7 @@ export interface LanguageConfiguration {
|
|
|
622
628
|
comments?: CommentRule;
|
|
623
629
|
folding?: FoldingRules;
|
|
624
630
|
wordPattern?: string;
|
|
631
|
+
onEnterRules?: OnEnterRule[];
|
|
625
632
|
}
|
|
626
633
|
|
|
627
634
|
/**
|
|
@@ -670,6 +677,19 @@ export interface FoldingRules {
|
|
|
670
677
|
markers?: FoldingMarkers;
|
|
671
678
|
}
|
|
672
679
|
|
|
680
|
+
export interface OnEnterRule {
|
|
681
|
+
beforeText: string;
|
|
682
|
+
afterText?: string;
|
|
683
|
+
previousLineText?: string;
|
|
684
|
+
action: EnterAction;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
export interface EnterAction {
|
|
688
|
+
indent: 'none' | 'indent' | 'outdent' | 'indentOutdent';
|
|
689
|
+
appendText?: string;
|
|
690
|
+
removeText?: number;
|
|
691
|
+
}
|
|
692
|
+
|
|
673
693
|
/**
|
|
674
694
|
* Custom Editors contribution
|
|
675
695
|
*/
|
|
@@ -796,6 +816,7 @@ export interface PluginMetadata {
|
|
|
796
816
|
model: PluginModel;
|
|
797
817
|
lifecycle: PluginLifecycle;
|
|
798
818
|
isUnderDevelopment?: boolean;
|
|
819
|
+
outOfSync: boolean;
|
|
799
820
|
}
|
|
800
821
|
|
|
801
822
|
export const MetadataProcessor = Symbol('MetadataProcessor');
|
|
@@ -822,22 +843,38 @@ export interface HostedPluginClient {
|
|
|
822
843
|
|
|
823
844
|
export interface PluginDependencies {
|
|
824
845
|
metadata: PluginMetadata
|
|
846
|
+
/**
|
|
847
|
+
* Actual listing of plugin dependencies.
|
|
848
|
+
* Mapping from {@link PluginIdentifiers.UnversionedId external representation} of plugin identity to a string
|
|
849
|
+
* that can be used to identify the resolver for the specific plugin case, e.g. with scheme `vscode://<id>`.
|
|
850
|
+
*/
|
|
825
851
|
mapping?: Map<string, string>
|
|
826
852
|
}
|
|
827
853
|
|
|
828
854
|
export const PluginDeployerHandler = Symbol('PluginDeployerHandler');
|
|
829
855
|
export interface PluginDeployerHandler {
|
|
830
|
-
deployFrontendPlugins(frontendPlugins: PluginDeployerEntry[]): Promise<
|
|
831
|
-
deployBackendPlugins(backendPlugins: PluginDeployerEntry[]): Promise<
|
|
856
|
+
deployFrontendPlugins(frontendPlugins: PluginDeployerEntry[]): Promise<number | undefined>;
|
|
857
|
+
deployBackendPlugins(backendPlugins: PluginDeployerEntry[]): Promise<number | undefined>;
|
|
858
|
+
|
|
859
|
+
getDeployedPluginsById(pluginId: string): DeployedPlugin[];
|
|
832
860
|
|
|
833
|
-
getDeployedPlugin(pluginId:
|
|
834
|
-
|
|
861
|
+
getDeployedPlugin(pluginId: PluginIdentifiers.VersionedId): DeployedPlugin | undefined;
|
|
862
|
+
/**
|
|
863
|
+
* Removes the plugin from the location it originally resided on disk.
|
|
864
|
+
* Unless `--uncompressed-plugins-in-place` is passed to the CLI, this operation is safe.
|
|
865
|
+
*/
|
|
866
|
+
uninstallPlugin(pluginId: PluginIdentifiers.VersionedId): Promise<boolean>;
|
|
867
|
+
/**
|
|
868
|
+
* Removes the plugin from the locations to which it had been deployed.
|
|
869
|
+
* This operation is not safe - references to deleted assets may remain.
|
|
870
|
+
*/
|
|
871
|
+
undeployPlugin(pluginId: PluginIdentifiers.VersionedId): Promise<boolean>;
|
|
835
872
|
|
|
836
873
|
getPluginDependencies(pluginToBeInstalled: PluginDeployerEntry): Promise<PluginDependencies | undefined>;
|
|
837
874
|
}
|
|
838
875
|
|
|
839
876
|
export interface GetDeployedPluginsParams {
|
|
840
|
-
pluginIds:
|
|
877
|
+
pluginIds: PluginIdentifiers.VersionedId[]
|
|
841
878
|
}
|
|
842
879
|
|
|
843
880
|
export interface DeployedPlugin {
|
|
@@ -852,7 +889,9 @@ export interface DeployedPlugin {
|
|
|
852
889
|
export const HostedPluginServer = Symbol('HostedPluginServer');
|
|
853
890
|
export interface HostedPluginServer extends JsonRpcServer<HostedPluginClient> {
|
|
854
891
|
|
|
855
|
-
getDeployedPluginIds(): Promise<
|
|
892
|
+
getDeployedPluginIds(): Promise<PluginIdentifiers.VersionedId[]>;
|
|
893
|
+
|
|
894
|
+
getUninstalledPluginIds(): Promise<readonly PluginIdentifiers.VersionedId[]>;
|
|
856
895
|
|
|
857
896
|
getDeployedPlugins(params: GetDeployedPluginsParams): Promise<DeployedPlugin[]>;
|
|
858
897
|
|
|
@@ -871,6 +910,12 @@ export interface WorkspaceStorageKind {
|
|
|
871
910
|
export type GlobalStorageKind = undefined;
|
|
872
911
|
export type PluginStorageKind = GlobalStorageKind | WorkspaceStorageKind;
|
|
873
912
|
|
|
913
|
+
export interface PluginDeployOptions {
|
|
914
|
+
version: string;
|
|
915
|
+
/** Instructs the deployer to ignore any existing plugins with different versions */
|
|
916
|
+
ignoreOtherVersions?: boolean;
|
|
917
|
+
}
|
|
918
|
+
|
|
874
919
|
/**
|
|
875
920
|
* The JSON-RPC workspace interface.
|
|
876
921
|
*/
|
|
@@ -883,9 +928,9 @@ export interface PluginServer {
|
|
|
883
928
|
*
|
|
884
929
|
* @param type whether a plugin is installed by a system or a user, defaults to a user
|
|
885
930
|
*/
|
|
886
|
-
deploy(pluginEntry: string, type?: PluginType): Promise<void>;
|
|
887
|
-
|
|
888
|
-
undeploy(pluginId:
|
|
931
|
+
deploy(pluginEntry: string, type?: PluginType, options?: PluginDeployOptions): Promise<void>;
|
|
932
|
+
uninstall(pluginId: PluginIdentifiers.VersionedId): Promise<void>;
|
|
933
|
+
undeploy(pluginId: PluginIdentifiers.VersionedId): Promise<void>;
|
|
889
934
|
|
|
890
935
|
setStorageValue(key: string, value: KeysToAnyValues, kind: PluginStorageKind): Promise<boolean>;
|
|
891
936
|
getStorageValue(key: string, kind: PluginStorageKind): Promise<KeysToAnyValues>;
|
|
@@ -910,7 +955,7 @@ export interface ServerPluginRunner {
|
|
|
910
955
|
/**
|
|
911
956
|
* Provides additional plugin ids.
|
|
912
957
|
*/
|
|
913
|
-
getExtraDeployedPluginIds(): Promise<
|
|
958
|
+
getExtraDeployedPluginIds(): Promise<PluginIdentifiers.VersionedId[]>;
|
|
914
959
|
|
|
915
960
|
}
|
|
916
961
|
|
|
@@ -25,7 +25,7 @@ import debounce = require('@theia/core/shared/lodash.debounce');
|
|
|
25
25
|
import { UUID } from '@theia/core/shared/@phosphor/coreutils';
|
|
26
26
|
import { injectable, inject, interfaces, named, postConstruct } from '@theia/core/shared/inversify';
|
|
27
27
|
import { PluginWorker } from './plugin-worker';
|
|
28
|
-
import { PluginMetadata, getPluginId, HostedPluginServer, DeployedPlugin, PluginServer } from '../../common/plugin-protocol';
|
|
28
|
+
import { PluginMetadata, getPluginId, HostedPluginServer, DeployedPlugin, PluginServer, PluginIdentifiers } from '../../common/plugin-protocol';
|
|
29
29
|
import { HostedPluginWatcher } from './hosted-plugin-watcher';
|
|
30
30
|
import { MAIN_RPC_CONTEXT, PluginManagerExt, ConfigStorage, UIKind } from '../../common/plugin-api-rpc';
|
|
31
31
|
import { setUpPluginApi } from '../../main/browser/main-context';
|
|
@@ -165,7 +165,7 @@ export class HostedPluginSupport {
|
|
|
165
165
|
|
|
166
166
|
protected readonly managers = new Map<string, PluginManagerExt>();
|
|
167
167
|
|
|
168
|
-
private readonly contributions = new Map<
|
|
168
|
+
private readonly contributions = new Map<PluginIdentifiers.UnversionedId, PluginContributions>();
|
|
169
169
|
|
|
170
170
|
protected readonly activationEvents = new Set<string>();
|
|
171
171
|
|
|
@@ -240,7 +240,7 @@ export class HostedPluginSupport {
|
|
|
240
240
|
return plugins;
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
-
getPlugin(id:
|
|
243
|
+
getPlugin(id: PluginIdentifiers.UnversionedId): DeployedPlugin | undefined {
|
|
244
244
|
const contributions = this.contributions.get(id);
|
|
245
245
|
return contributions && contributions.plugin;
|
|
246
246
|
}
|
|
@@ -312,27 +312,38 @@ export class HostedPluginSupport {
|
|
|
312
312
|
let syncPluginsMeasurement: Measurement | undefined;
|
|
313
313
|
|
|
314
314
|
const toUnload = new Set(this.contributions.keys());
|
|
315
|
+
let didChangeInstallationStatus = false;
|
|
315
316
|
try {
|
|
316
|
-
const
|
|
317
|
-
const deployedPluginIds = await this.server.getDeployedPluginIds();
|
|
317
|
+
const newPluginIds: PluginIdentifiers.VersionedId[] = [];
|
|
318
|
+
const [deployedPluginIds, uninstalledPluginIds] = await Promise.all([this.server.getDeployedPluginIds(), this.server.getUninstalledPluginIds()]);
|
|
318
319
|
waitPluginsMeasurement.log('Waiting for backend deployment');
|
|
319
320
|
syncPluginsMeasurement = this.measure('syncPlugins');
|
|
320
|
-
for (const
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
321
|
+
for (const versionedId of deployedPluginIds) {
|
|
322
|
+
const unversionedId = PluginIdentifiers.unversionedFromVersioned(versionedId);
|
|
323
|
+
toUnload.delete(unversionedId);
|
|
324
|
+
if (!this.contributions.has(unversionedId)) {
|
|
325
|
+
newPluginIds.push(versionedId);
|
|
324
326
|
}
|
|
325
327
|
}
|
|
326
328
|
for (const pluginId of toUnload) {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
329
|
+
this.contributions.get(pluginId)?.dispose();
|
|
330
|
+
}
|
|
331
|
+
for (const versionedId of uninstalledPluginIds) {
|
|
332
|
+
const plugin = this.getPlugin(PluginIdentifiers.unversionedFromVersioned(versionedId));
|
|
333
|
+
if (plugin && PluginIdentifiers.componentsToVersionedId(plugin.metadata.model) === versionedId && !plugin.metadata.outOfSync) {
|
|
334
|
+
plugin.metadata.outOfSync = didChangeInstallationStatus = true;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
for (const contribution of this.contributions.values()) {
|
|
338
|
+
if (contribution.plugin.metadata.outOfSync && !uninstalledPluginIds.includes(PluginIdentifiers.componentsToVersionedId(contribution.plugin.metadata.model))) {
|
|
339
|
+
contribution.plugin.metadata.outOfSync = false;
|
|
340
|
+
didChangeInstallationStatus = true;
|
|
330
341
|
}
|
|
331
342
|
}
|
|
332
|
-
if (
|
|
333
|
-
const plugins = await this.server.getDeployedPlugins({ pluginIds });
|
|
343
|
+
if (newPluginIds.length) {
|
|
344
|
+
const plugins = await this.server.getDeployedPlugins({ pluginIds: newPluginIds });
|
|
334
345
|
for (const plugin of plugins) {
|
|
335
|
-
const pluginId = plugin.metadata.model
|
|
346
|
+
const pluginId = PluginIdentifiers.componentsToUnversionedId(plugin.metadata.model);
|
|
336
347
|
const contributions = new PluginContributions(plugin);
|
|
337
348
|
this.contributions.set(pluginId, contributions);
|
|
338
349
|
contributions.push(Disposable.create(() => this.contributions.delete(pluginId)));
|
|
@@ -340,7 +351,7 @@ export class HostedPluginSupport {
|
|
|
340
351
|
}
|
|
341
352
|
}
|
|
342
353
|
} finally {
|
|
343
|
-
if (initialized || toUnload.size) {
|
|
354
|
+
if (initialized || toUnload.size || didChangeInstallationStatus) {
|
|
344
355
|
this.onDidChangePluginsEmitter.fire(undefined);
|
|
345
356
|
}
|
|
346
357
|
|
|
@@ -567,11 +578,7 @@ export class HostedPluginSupport {
|
|
|
567
578
|
return;
|
|
568
579
|
}
|
|
569
580
|
this.activationEvents.add(activationEvent);
|
|
570
|
-
|
|
571
|
-
for (const manager of this.managers.values()) {
|
|
572
|
-
activation.push(manager.$activateByEvent(activationEvent));
|
|
573
|
-
}
|
|
574
|
-
await Promise.all(activation);
|
|
581
|
+
await Promise.all(Array.from(this.managers.values(), manager => manager.$activateByEvent(activationEvent)));
|
|
575
582
|
}
|
|
576
583
|
|
|
577
584
|
async activateByViewContainer(viewContainerId: string): Promise<void> {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
17
|
// eslint-disable-next-line @theia/runtime-import-check
|
|
18
|
-
import { DebugExtImpl } from '../../../plugin/
|
|
18
|
+
import { DebugExtImpl } from '../../../plugin/debug/debug-ext';
|
|
19
19
|
import { RPCProtocol } from '../../../common/rpc-protocol';
|
|
20
20
|
|
|
21
21
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
18
18
|
|
|
19
|
-
import { PluginModel, PluginPackage } from '../../../common/plugin-protocol';
|
|
19
|
+
import { PluginIdentifiers, PluginModel, PluginPackage } from '../../../common/plugin-protocol';
|
|
20
20
|
import { Endpoint } from '@theia/core/lib/browser/endpoint';
|
|
21
21
|
import URI from '@theia/core/lib/common/uri';
|
|
22
22
|
|
|
@@ -54,7 +54,9 @@ function readContents(uri: string): Promise<string> {
|
|
|
54
54
|
|
|
55
55
|
async function readPluginJson(pluginModel: PluginModel, relativePath: string): Promise<any> {
|
|
56
56
|
const content = await readPluginFile(pluginModel, relativePath);
|
|
57
|
-
|
|
57
|
+
const json = JSON.parse(content) as PluginPackage;
|
|
58
|
+
json.publisher ??= PluginIdentifiers.UNPUBLISHED;
|
|
59
|
+
return json;
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
export async function loadManifest(pluginModel: PluginModel): Promise<any> {
|
|
@@ -17,11 +17,15 @@
|
|
|
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 {
|
|
20
|
+
import {
|
|
21
|
+
PluginDeployerHandler, PluginDeployerEntry, PluginEntryPoint, DeployedPlugin,
|
|
22
|
+
PluginDependencies, PluginType, PluginIdentifiers
|
|
23
|
+
} from '../../common/plugin-protocol';
|
|
21
24
|
import { HostedPluginReader } from './plugin-reader';
|
|
22
25
|
import { Deferred } from '@theia/core/lib/common/promise-util';
|
|
23
26
|
import { HostedPluginLocalizationService } from './hosted-plugin-localization-service';
|
|
24
27
|
import { Stopwatch } from '@theia/core/lib/common';
|
|
28
|
+
import { PluginUninstallationManager } from '../../main/node/plugin-uninstallation-manager';
|
|
25
29
|
|
|
26
30
|
@injectable()
|
|
27
31
|
export class HostedPluginDeployerHandler implements PluginDeployerHandler {
|
|
@@ -38,42 +42,56 @@ export class HostedPluginDeployerHandler implements PluginDeployerHandler {
|
|
|
38
42
|
@inject(Stopwatch)
|
|
39
43
|
protected readonly stopwatch: Stopwatch;
|
|
40
44
|
|
|
41
|
-
|
|
45
|
+
@inject(PluginUninstallationManager)
|
|
46
|
+
protected readonly uninstallationManager: PluginUninstallationManager;
|
|
47
|
+
|
|
48
|
+
private readonly deployedLocations = new Map<PluginIdentifiers.VersionedId, Set<string>>();
|
|
49
|
+
protected readonly sourceLocations = new Map<PluginIdentifiers.VersionedId, Set<string>>();
|
|
42
50
|
|
|
43
51
|
/**
|
|
44
52
|
* Managed plugin metadata backend entries.
|
|
45
53
|
*/
|
|
46
|
-
private readonly deployedBackendPlugins = new Map<
|
|
54
|
+
private readonly deployedBackendPlugins = new Map<PluginIdentifiers.VersionedId, DeployedPlugin>();
|
|
47
55
|
|
|
48
56
|
/**
|
|
49
57
|
* Managed plugin metadata frontend entries.
|
|
50
58
|
*/
|
|
51
|
-
private readonly deployedFrontendPlugins = new Map<
|
|
59
|
+
private readonly deployedFrontendPlugins = new Map<PluginIdentifiers.VersionedId, DeployedPlugin>();
|
|
52
60
|
|
|
53
61
|
private backendPluginsMetadataDeferred = new Deferred<void>();
|
|
54
62
|
|
|
55
63
|
private frontendPluginsMetadataDeferred = new Deferred<void>();
|
|
56
64
|
|
|
57
|
-
async getDeployedFrontendPluginIds(): Promise<
|
|
65
|
+
async getDeployedFrontendPluginIds(): Promise<PluginIdentifiers.VersionedId[]> {
|
|
58
66
|
// await first deploy
|
|
59
67
|
await this.frontendPluginsMetadataDeferred.promise;
|
|
60
68
|
// fetch the last deployed state
|
|
61
|
-
return
|
|
69
|
+
return Array.from(this.deployedFrontendPlugins.keys());
|
|
62
70
|
}
|
|
63
71
|
|
|
64
|
-
async getDeployedBackendPluginIds(): Promise<
|
|
72
|
+
async getDeployedBackendPluginIds(): Promise<PluginIdentifiers.VersionedId[]> {
|
|
65
73
|
// await first deploy
|
|
66
74
|
await this.backendPluginsMetadataDeferred.promise;
|
|
67
75
|
// fetch the last deployed state
|
|
68
|
-
return
|
|
76
|
+
return Array.from(this.deployedBackendPlugins.keys());
|
|
69
77
|
}
|
|
70
78
|
|
|
71
|
-
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
79
|
+
getDeployedPluginsById(pluginId: string): DeployedPlugin[] {
|
|
80
|
+
const matches: DeployedPlugin[] = [];
|
|
81
|
+
const handle = (plugins: Iterable<DeployedPlugin>): void => {
|
|
82
|
+
for (const plugin of plugins) {
|
|
83
|
+
if (PluginIdentifiers.componentsToVersionWithId(plugin.metadata.model).id === pluginId) {
|
|
84
|
+
matches.push(plugin);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
handle(this.deployedFrontendPlugins.values());
|
|
89
|
+
handle(this.deployedBackendPlugins.values());
|
|
90
|
+
return matches;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
getDeployedPlugin(pluginId: PluginIdentifiers.VersionedId): DeployedPlugin | undefined {
|
|
94
|
+
return this.deployedBackendPlugins.get(pluginId) ?? this.deployedFrontendPlugins.get(pluginId);
|
|
77
95
|
}
|
|
78
96
|
|
|
79
97
|
/**
|
|
@@ -99,62 +117,115 @@ export class HostedPluginDeployerHandler implements PluginDeployerHandler {
|
|
|
99
117
|
}
|
|
100
118
|
}
|
|
101
119
|
|
|
102
|
-
async deployFrontendPlugins(frontendPlugins: PluginDeployerEntry[]): Promise<
|
|
120
|
+
async deployFrontendPlugins(frontendPlugins: PluginDeployerEntry[]): Promise<number> {
|
|
121
|
+
let successes = 0;
|
|
103
122
|
for (const plugin of frontendPlugins) {
|
|
104
|
-
await this.deployPlugin(plugin, 'frontend')
|
|
123
|
+
if (await this.deployPlugin(plugin, 'frontend')) { successes++; }
|
|
105
124
|
}
|
|
106
125
|
// resolve on first deploy
|
|
107
126
|
this.frontendPluginsMetadataDeferred.resolve(undefined);
|
|
127
|
+
return successes;
|
|
108
128
|
}
|
|
109
129
|
|
|
110
|
-
async deployBackendPlugins(backendPlugins: PluginDeployerEntry[]): Promise<
|
|
130
|
+
async deployBackendPlugins(backendPlugins: PluginDeployerEntry[]): Promise<number> {
|
|
131
|
+
let successes = 0;
|
|
111
132
|
for (const plugin of backendPlugins) {
|
|
112
|
-
await this.deployPlugin(plugin, 'backend')
|
|
133
|
+
if (await this.deployPlugin(plugin, 'backend')) { successes++; }
|
|
113
134
|
}
|
|
114
135
|
// rebuild translation config after deployment
|
|
115
136
|
this.localizationService.buildTranslationConfig([...this.deployedBackendPlugins.values()]);
|
|
116
137
|
// resolve on first deploy
|
|
117
138
|
this.backendPluginsMetadataDeferred.resolve(undefined);
|
|
139
|
+
return successes;
|
|
118
140
|
}
|
|
119
141
|
|
|
120
142
|
/**
|
|
121
|
-
* @throws never! in order to isolate plugin deployment
|
|
143
|
+
* @throws never! in order to isolate plugin deployment.
|
|
144
|
+
* @returns whether the plugin is deployed after running this function. If the plugin was already installed, will still return `true`.
|
|
122
145
|
*/
|
|
123
|
-
protected async deployPlugin(entry: PluginDeployerEntry, entryPoint: keyof PluginEntryPoint): Promise<
|
|
146
|
+
protected async deployPlugin(entry: PluginDeployerEntry, entryPoint: keyof PluginEntryPoint): Promise<boolean> {
|
|
124
147
|
const pluginPath = entry.path();
|
|
125
148
|
const deployPlugin = this.stopwatch.start('deployPlugin');
|
|
149
|
+
let id;
|
|
150
|
+
let success = true;
|
|
126
151
|
try {
|
|
127
152
|
const manifest = await this.reader.readPackage(pluginPath);
|
|
128
153
|
if (!manifest) {
|
|
129
154
|
deployPlugin.error(`Failed to read ${entryPoint} plugin manifest from '${pluginPath}''`);
|
|
130
|
-
return;
|
|
155
|
+
return success = false;
|
|
131
156
|
}
|
|
132
157
|
|
|
133
158
|
const metadata = this.reader.readMetadata(manifest);
|
|
134
159
|
metadata.isUnderDevelopment = entry.getValue('isUnderDevelopment') ?? false;
|
|
135
160
|
|
|
136
|
-
|
|
161
|
+
id = PluginIdentifiers.componentsToVersionedId(metadata.model);
|
|
162
|
+
|
|
163
|
+
const deployedLocations = this.deployedLocations.get(id) ?? new Set<string>();
|
|
137
164
|
deployedLocations.add(entry.rootPath);
|
|
138
|
-
this.deployedLocations.set(
|
|
165
|
+
this.deployedLocations.set(id, deployedLocations);
|
|
166
|
+
this.setSourceLocationsForPlugin(id, entry);
|
|
139
167
|
|
|
140
168
|
const deployedPlugins = entryPoint === 'backend' ? this.deployedBackendPlugins : this.deployedFrontendPlugins;
|
|
141
|
-
if (deployedPlugins.has(
|
|
169
|
+
if (deployedPlugins.has(id)) {
|
|
142
170
|
deployPlugin.debug(`Skipped ${entryPoint} plugin ${metadata.model.name} already deployed`);
|
|
143
|
-
return;
|
|
171
|
+
return true;
|
|
144
172
|
}
|
|
145
173
|
|
|
146
174
|
const { type } = entry;
|
|
147
175
|
const deployed: DeployedPlugin = { metadata, type };
|
|
148
176
|
deployed.contributes = this.reader.readContribution(manifest);
|
|
149
177
|
this.localizationService.deployLocalizations(deployed);
|
|
150
|
-
deployedPlugins.set(
|
|
151
|
-
deployPlugin.log(`Deployed ${entryPoint} plugin "${
|
|
178
|
+
deployedPlugins.set(id, deployed);
|
|
179
|
+
deployPlugin.log(`Deployed ${entryPoint} plugin "${id}" from "${metadata.model.entryPoint[entryPoint] || pluginPath}"`);
|
|
152
180
|
} catch (e) {
|
|
153
181
|
deployPlugin.error(`Failed to deploy ${entryPoint} plugin from '${pluginPath}' path`, e);
|
|
182
|
+
return success = false;
|
|
183
|
+
} finally {
|
|
184
|
+
if (success && id) {
|
|
185
|
+
this.markAsInstalled(id);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return success;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
async uninstallPlugin(pluginId: PluginIdentifiers.VersionedId): Promise<boolean> {
|
|
192
|
+
try {
|
|
193
|
+
const sourceLocations = this.sourceLocations.get(pluginId);
|
|
194
|
+
if (!sourceLocations) {
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
await Promise.all(Array.from(sourceLocations,
|
|
198
|
+
location => fs.remove(location).catch(err => console.error(`Failed to remove source for ${pluginId} at ${location}`, err))));
|
|
199
|
+
this.sourceLocations.delete(pluginId);
|
|
200
|
+
this.uninstallationManager.markAsUninstalled(pluginId);
|
|
201
|
+
return true;
|
|
202
|
+
} catch (e) {
|
|
203
|
+
console.error('Error uninstalling plugin', e);
|
|
204
|
+
return false;
|
|
154
205
|
}
|
|
155
206
|
}
|
|
156
207
|
|
|
157
|
-
|
|
208
|
+
protected markAsInstalled(id: PluginIdentifiers.VersionedId): void {
|
|
209
|
+
const metadata = PluginIdentifiers.idAndVersionFromVersionedId(id);
|
|
210
|
+
if (metadata) {
|
|
211
|
+
const toMarkAsUninstalled: PluginIdentifiers.VersionedId[] = [];
|
|
212
|
+
const checkForDifferentVersions = (others: Iterable<PluginIdentifiers.VersionedId>) => {
|
|
213
|
+
for (const other of others) {
|
|
214
|
+
const otherMetadata = PluginIdentifiers.idAndVersionFromVersionedId(other);
|
|
215
|
+
if (metadata.id === otherMetadata?.id && metadata.version !== otherMetadata.version) {
|
|
216
|
+
toMarkAsUninstalled.push(other);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
checkForDifferentVersions(this.deployedFrontendPlugins.keys());
|
|
221
|
+
checkForDifferentVersions(this.deployedBackendPlugins.keys());
|
|
222
|
+
this.uninstallationManager.markAsUninstalled(...toMarkAsUninstalled);
|
|
223
|
+
this.uninstallationManager.markAsInstalled(id);
|
|
224
|
+
toMarkAsUninstalled.forEach(pluginToUninstall => this.uninstallPlugin(pluginToUninstall));
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
async undeployPlugin(pluginId: PluginIdentifiers.VersionedId): Promise<boolean> {
|
|
158
229
|
this.deployedBackendPlugins.delete(pluginId);
|
|
159
230
|
this.deployedFrontendPlugins.delete(pluginId);
|
|
160
231
|
const deployedLocations = this.deployedLocations.get(pluginId);
|
|
@@ -176,4 +247,14 @@ export class HostedPluginDeployerHandler implements PluginDeployerHandler {
|
|
|
176
247
|
|
|
177
248
|
return true;
|
|
178
249
|
}
|
|
250
|
+
|
|
251
|
+
protected setSourceLocationsForPlugin(id: PluginIdentifiers.VersionedId, entry: PluginDeployerEntry): void {
|
|
252
|
+
const knownLocations = this.sourceLocations.get(id) ?? new Set();
|
|
253
|
+
const maybeStoredLocations = entry.getValue('sourceLocations');
|
|
254
|
+
const storedLocations = Array.isArray(maybeStoredLocations) && maybeStoredLocations.every(location => typeof location === 'string')
|
|
255
|
+
? maybeStoredLocations.concat(entry.originalPath())
|
|
256
|
+
: [entry.originalPath()];
|
|
257
|
+
storedLocations.forEach(location => knownLocations.add(location));
|
|
258
|
+
this.sourceLocations.set(id, knownLocations);
|
|
259
|
+
}
|
|
179
260
|
}
|
|
@@ -19,7 +19,7 @@ import * as fs from '@theia/core/shared/fs-extra';
|
|
|
19
19
|
import { LocalizationProvider } from '@theia/core/lib/node/i18n/localization-provider';
|
|
20
20
|
import { Localization } from '@theia/core/lib/common/i18n/localization';
|
|
21
21
|
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
22
|
-
import { DeployedPlugin, Localization as PluginLocalization
|
|
22
|
+
import { DeployedPlugin, Localization as PluginLocalization } from '../../common';
|
|
23
23
|
import { URI } from '@theia/core/shared/vscode-uri';
|
|
24
24
|
import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
|
|
25
25
|
|
|
@@ -55,18 +55,16 @@ export class HostedPluginLocalizationService {
|
|
|
55
55
|
const localization = this.localizationProvider.loadLocalization(currentLanguage);
|
|
56
56
|
const pluginPath = URI.parse(plugin.metadata.model.packageUri).fsPath;
|
|
57
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
58
|
try {
|
|
61
59
|
const translations = await loadPackageTranslations(pluginPath, currentLanguage);
|
|
62
|
-
|
|
60
|
+
plugin = localizePackage(plugin, translations, (key, original) => {
|
|
63
61
|
const fullKey = `${pluginId}/package/${key}`;
|
|
64
62
|
return Localization.localize(localization, fullKey, original);
|
|
65
|
-
}) as
|
|
63
|
+
}) as DeployedPlugin;
|
|
66
64
|
} catch (err) {
|
|
67
65
|
console.error(`Failed to localize plugin '${pluginId}'.`, err);
|
|
68
66
|
}
|
|
69
|
-
return
|
|
67
|
+
return plugin;
|
|
70
68
|
}
|
|
71
69
|
|
|
72
70
|
getNlsConfig(): VSCodeNlsConfig {
|