@theia/plugin 1.53.0-next.5 → 1.53.0-next.55
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/README.md +766 -766
- package/package.json +3 -3
- package/src/package.spec.ts +28 -28
- package/src/theia-extra.d.ts +410 -410
- package/src/theia.d.ts +18078 -17684
- package/src/theia.proposed.canonicalUriProvider.d.ts +64 -64
- package/src/theia.proposed.customEditorMove.d.ts +41 -41
- package/src/theia.proposed.debugVisualization.d.ts +189 -189
- package/src/theia.proposed.diffCommand.d.ts +55 -55
- package/src/theia.proposed.documentPaste.d.ts +316 -316
- package/src/theia.proposed.editSessionIdentityProvider.d.ts +89 -89
- package/src/theia.proposed.extensionsAny.d.ts +57 -57
- package/src/theia.proposed.externalUriOpener.d.ts +158 -158
- package/src/theia.proposed.findTextInFiles.d.ts +178 -178
- package/src/theia.proposed.fsChunks.d.ts +32 -32
- package/src/theia.proposed.mappedEditsProvider.d.ts +59 -59
- package/src/theia.proposed.multiDocumentHighlightProvider.ts +82 -82
- package/src/theia.proposed.notebookCellExecutionState.d.ts +68 -68
- package/src/theia.proposed.notebookKernelSource.d.ts +62 -62
- package/src/theia.proposed.notebookMessaging.d.ts +84 -84
- package/src/theia.proposed.portsAttributes.d.ts +115 -115
- package/src/theia.proposed.profileContentHandlers.d.ts +35 -35
- package/src/theia.proposed.resolvers.d.ts +44 -44
- package/src/theia.proposed.scmValidation.d.ts +70 -70
- package/src/theia.proposed.shareProvider.d.ts +92 -92
- package/src/theia.proposed.terminalQuickFixProvider.d.ts +103 -103
- package/src/theia.proposed.textSearchProvider.d.ts +145 -145
- package/src/theia.proposed.timeline.d.ts +177 -177
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2023 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-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
/*---------------------------------------------------------------------------------------------
|
|
18
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
19
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
20
|
-
*--------------------------------------------------------------------------------------------*/
|
|
21
|
-
// code copied and modified from https://github.com/microsoft/vscode/blob/1.77.0/src/vscode-dts/vscode.proposed.editSessionIdentityProvider.d.ts
|
|
22
|
-
|
|
23
|
-
export module '@theia/plugin' {
|
|
24
|
-
|
|
25
|
-
// https://github.com/microsoft/vscode/issues/157734
|
|
26
|
-
|
|
27
|
-
export namespace workspace {
|
|
28
|
-
/**
|
|
29
|
-
* An event that is emitted when an edit session identity is about to be requested.
|
|
30
|
-
*/
|
|
31
|
-
export const onWillCreateEditSessionIdentity: Event<EditSessionIdentityWillCreateEvent>;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
*
|
|
35
|
-
* @param scheme The URI scheme that this provider can provide edit session identities for.
|
|
36
|
-
* @param provider A provider which can convert URIs for workspace folders of scheme @param scheme to
|
|
37
|
-
* an edit session identifier which is stable across machines. This enables edit sessions to be resolved.
|
|
38
|
-
*/
|
|
39
|
-
export function registerEditSessionIdentityProvider(scheme: string, provider: EditSessionIdentityProvider): Disposable;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export interface EditSessionIdentityProvider {
|
|
43
|
-
/**
|
|
44
|
-
*
|
|
45
|
-
* @param workspaceFolder The workspace folder to provide an edit session identity for.
|
|
46
|
-
* @param token A cancellation token for the request.
|
|
47
|
-
* @returns A string representing the edit session identity for the requested workspace folder.
|
|
48
|
-
*/
|
|
49
|
-
provideEditSessionIdentity(workspaceFolder: WorkspaceFolder, token: CancellationToken): ProviderResult<string>;
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
*
|
|
53
|
-
* @param identity1 An edit session identity.
|
|
54
|
-
* @param identity2 A second edit session identity to compare to @param identity1.
|
|
55
|
-
* @param token A cancellation token for the request.
|
|
56
|
-
* @returns An {@link EditSessionIdentityMatch} representing the edit session identity match confidence for the provided identities.
|
|
57
|
-
*/
|
|
58
|
-
provideEditSessionIdentityMatch(identity1: string, identity2: string, token: CancellationToken): ProviderResult<EditSessionIdentityMatch>;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export enum EditSessionIdentityMatch {
|
|
62
|
-
Complete = 100,
|
|
63
|
-
Partial = 50,
|
|
64
|
-
None = 0
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export interface EditSessionIdentityWillCreateEvent {
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* A cancellation token.
|
|
71
|
-
*/
|
|
72
|
-
readonly token: CancellationToken;
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* The workspace folder to create an edit session identity for.
|
|
76
|
-
*/
|
|
77
|
-
readonly workspaceFolder: WorkspaceFolder;
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Allows to pause the event until the provided thenable resolves.
|
|
81
|
-
*
|
|
82
|
-
* *Note:* This function can only be called during event dispatch.
|
|
83
|
-
*
|
|
84
|
-
* @param thenable A thenable that delays saving.
|
|
85
|
-
*/
|
|
86
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
87
|
-
waitUntil(thenable: Thenable<any>): void;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2023 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-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
/*---------------------------------------------------------------------------------------------
|
|
18
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
19
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
20
|
+
*--------------------------------------------------------------------------------------------*/
|
|
21
|
+
// code copied and modified from https://github.com/microsoft/vscode/blob/1.77.0/src/vscode-dts/vscode.proposed.editSessionIdentityProvider.d.ts
|
|
22
|
+
|
|
23
|
+
export module '@theia/plugin' {
|
|
24
|
+
|
|
25
|
+
// https://github.com/microsoft/vscode/issues/157734
|
|
26
|
+
|
|
27
|
+
export namespace workspace {
|
|
28
|
+
/**
|
|
29
|
+
* An event that is emitted when an edit session identity is about to be requested.
|
|
30
|
+
*/
|
|
31
|
+
export const onWillCreateEditSessionIdentity: Event<EditSessionIdentityWillCreateEvent>;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* @param scheme The URI scheme that this provider can provide edit session identities for.
|
|
36
|
+
* @param provider A provider which can convert URIs for workspace folders of scheme @param scheme to
|
|
37
|
+
* an edit session identifier which is stable across machines. This enables edit sessions to be resolved.
|
|
38
|
+
*/
|
|
39
|
+
export function registerEditSessionIdentityProvider(scheme: string, provider: EditSessionIdentityProvider): Disposable;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface EditSessionIdentityProvider {
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @param workspaceFolder The workspace folder to provide an edit session identity for.
|
|
46
|
+
* @param token A cancellation token for the request.
|
|
47
|
+
* @returns A string representing the edit session identity for the requested workspace folder.
|
|
48
|
+
*/
|
|
49
|
+
provideEditSessionIdentity(workspaceFolder: WorkspaceFolder, token: CancellationToken): ProviderResult<string>;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
* @param identity1 An edit session identity.
|
|
54
|
+
* @param identity2 A second edit session identity to compare to @param identity1.
|
|
55
|
+
* @param token A cancellation token for the request.
|
|
56
|
+
* @returns An {@link EditSessionIdentityMatch} representing the edit session identity match confidence for the provided identities.
|
|
57
|
+
*/
|
|
58
|
+
provideEditSessionIdentityMatch(identity1: string, identity2: string, token: CancellationToken): ProviderResult<EditSessionIdentityMatch>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export enum EditSessionIdentityMatch {
|
|
62
|
+
Complete = 100,
|
|
63
|
+
Partial = 50,
|
|
64
|
+
None = 0
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface EditSessionIdentityWillCreateEvent {
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* A cancellation token.
|
|
71
|
+
*/
|
|
72
|
+
readonly token: CancellationToken;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The workspace folder to create an edit session identity for.
|
|
76
|
+
*/
|
|
77
|
+
readonly workspaceFolder: WorkspaceFolder;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Allows to pause the event until the provided thenable resolves.
|
|
81
|
+
*
|
|
82
|
+
* *Note:* This function can only be called during event dispatch.
|
|
83
|
+
*
|
|
84
|
+
* @param thenable A thenable that delays saving.
|
|
85
|
+
*/
|
|
86
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
87
|
+
waitUntil(thenable: Thenable<any>): void;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2023 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-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
/*---------------------------------------------------------------------------------------------
|
|
18
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
19
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
20
|
-
*--------------------------------------------------------------------------------------------*/
|
|
21
|
-
// code copied and modified from https://github.com/microsoft/vscode/blob/1.77.0/src/vscode-dts/vscode.proposed.extensionsAny.d.ts
|
|
22
|
-
|
|
23
|
-
export module '@theia/plugin' {
|
|
24
|
-
|
|
25
|
-
export interface Extension<T> {
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* `true` when the extension is associated to another extension host.
|
|
29
|
-
*
|
|
30
|
-
* *Note* that an extension from another extension host cannot export
|
|
31
|
-
* API, e.g {@link Extension.exports its exports} are always `undefined`.
|
|
32
|
-
*/
|
|
33
|
-
readonly isFromDifferentExtensionHost: boolean;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export namespace extensions {
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Get an extension by its full identifier in the form of: `publisher.name`.
|
|
40
|
-
*
|
|
41
|
-
* @param extensionId An extension identifier.
|
|
42
|
-
* @param includeDifferentExtensionHosts Include extensions from different extension host
|
|
43
|
-
* @return An extension or `undefined`.
|
|
44
|
-
*/
|
|
45
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
46
|
-
export function getExtension<T = any>(extensionId: string, includeDifferentExtensionHosts: boolean): Extension<T> | undefined;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* All extensions across all extension hosts.
|
|
50
|
-
*
|
|
51
|
-
* @see {@link Extension.isFromDifferentExtensionHost}
|
|
52
|
-
*/
|
|
53
|
-
export const allAcrossExtensionHosts: readonly Extension<void>[];
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2023 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-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
/*---------------------------------------------------------------------------------------------
|
|
18
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
19
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
20
|
+
*--------------------------------------------------------------------------------------------*/
|
|
21
|
+
// code copied and modified from https://github.com/microsoft/vscode/blob/1.77.0/src/vscode-dts/vscode.proposed.extensionsAny.d.ts
|
|
22
|
+
|
|
23
|
+
export module '@theia/plugin' {
|
|
24
|
+
|
|
25
|
+
export interface Extension<T> {
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* `true` when the extension is associated to another extension host.
|
|
29
|
+
*
|
|
30
|
+
* *Note* that an extension from another extension host cannot export
|
|
31
|
+
* API, e.g {@link Extension.exports its exports} are always `undefined`.
|
|
32
|
+
*/
|
|
33
|
+
readonly isFromDifferentExtensionHost: boolean;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export namespace extensions {
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Get an extension by its full identifier in the form of: `publisher.name`.
|
|
40
|
+
*
|
|
41
|
+
* @param extensionId An extension identifier.
|
|
42
|
+
* @param includeDifferentExtensionHosts Include extensions from different extension host
|
|
43
|
+
* @return An extension or `undefined`.
|
|
44
|
+
*/
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
46
|
+
export function getExtension<T = any>(extensionId: string, includeDifferentExtensionHosts: boolean): Extension<T> | undefined;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* All extensions across all extension hosts.
|
|
50
|
+
*
|
|
51
|
+
* @see {@link Extension.isFromDifferentExtensionHost}
|
|
52
|
+
*/
|
|
53
|
+
export const allAcrossExtensionHosts: readonly Extension<void>[];
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
}
|
|
@@ -1,158 +1,158 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2023 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-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
/*---------------------------------------------------------------------------------------------
|
|
18
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
19
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
20
|
-
*--------------------------------------------------------------------------------------------*/
|
|
21
|
-
// code copied and modified from https://github.com/microsoft/vscode/blob/1.77.0/src/vscode-dts/vscode.proposed.externalUriOpener.d.ts
|
|
22
|
-
|
|
23
|
-
export module '@theia/plugin' {
|
|
24
|
-
/**
|
|
25
|
-
* Details if an `ExternalUriOpener` can open a uri.
|
|
26
|
-
*
|
|
27
|
-
* The priority is also used to rank multiple openers against each other and determine
|
|
28
|
-
* if an opener should be selected automatically or if the user should be prompted to
|
|
29
|
-
* select an opener.
|
|
30
|
-
*
|
|
31
|
-
* The editor will try to use the best available opener, as sorted by `ExternalUriOpenerPriority`.
|
|
32
|
-
* If there are multiple potential "best" openers for a URI, then the user will be prompted
|
|
33
|
-
* to select an opener.
|
|
34
|
-
*/
|
|
35
|
-
export enum ExternalUriOpenerPriority {
|
|
36
|
-
/**
|
|
37
|
-
* The opener is disabled and will never be shown to users.
|
|
38
|
-
*
|
|
39
|
-
* Note that the opener can still be used if the user specifically
|
|
40
|
-
* configures it in their settings.
|
|
41
|
-
*/
|
|
42
|
-
None = 0,
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* The opener can open the uri but will not cause a prompt on its own
|
|
46
|
-
* since the editor always contributes a built-in `Default` opener.
|
|
47
|
-
*/
|
|
48
|
-
Option = 1,
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* The opener can open the uri.
|
|
52
|
-
*
|
|
53
|
-
* The editor's built-in opener has `Default` priority. This means that any additional `Default`
|
|
54
|
-
* openers will cause the user to be prompted to select from a list of all potential openers.
|
|
55
|
-
*/
|
|
56
|
-
Default = 2,
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* The opener can open the uri and should be automatically selected over any
|
|
60
|
-
* default openers, include the built-in one from the editor.
|
|
61
|
-
*
|
|
62
|
-
* A preferred opener will be automatically selected if no other preferred openers
|
|
63
|
-
* are available. If multiple preferred openers are available, then the user
|
|
64
|
-
* is shown a prompt with all potential openers (not just preferred openers).
|
|
65
|
-
*/
|
|
66
|
-
Preferred = 3,
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Handles opening uris to external resources, such as http(s) links.
|
|
71
|
-
*
|
|
72
|
-
* Extensions can implement an `ExternalUriOpener` to open `http` links to a webserver
|
|
73
|
-
* inside of the editor instead of having the link be opened by the web browser.
|
|
74
|
-
*
|
|
75
|
-
* Currently openers may only be registered for `http` and `https` uris.
|
|
76
|
-
*/
|
|
77
|
-
export interface ExternalUriOpener {
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Check if the opener can open a uri.
|
|
81
|
-
*
|
|
82
|
-
* @param uri The uri being opened. This is the uri that the user clicked on. It has
|
|
83
|
-
* not yet gone through port forwarding.
|
|
84
|
-
* @param token Cancellation token indicating that the result is no longer needed.
|
|
85
|
-
*
|
|
86
|
-
* @return Priority indicating if the opener can open the external uri.
|
|
87
|
-
*/
|
|
88
|
-
canOpenExternalUri(uri: Uri, token: CancellationToken): ExternalUriOpenerPriority | Thenable<ExternalUriOpenerPriority>;
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Open a uri.
|
|
92
|
-
*
|
|
93
|
-
* This is invoked when:
|
|
94
|
-
*
|
|
95
|
-
* - The user clicks a link which does not have an assigned opener. In this case, first `canOpenExternalUri`
|
|
96
|
-
* is called and if the user selects this opener, then `openExternalUri` is called.
|
|
97
|
-
* - The user sets the default opener for a link in their settings and then visits a link.
|
|
98
|
-
*
|
|
99
|
-
* @param resolvedUri The uri to open. This uri may have been transformed by port forwarding, so it
|
|
100
|
-
* may not match the original uri passed to `canOpenExternalUri`. Use `ctx.originalUri` to check the
|
|
101
|
-
* original uri.
|
|
102
|
-
* @param ctx Additional information about the uri being opened.
|
|
103
|
-
* @param token Cancellation token indicating that opening has been canceled.
|
|
104
|
-
*
|
|
105
|
-
* @return Thenable indicating that the opening has completed.
|
|
106
|
-
*/
|
|
107
|
-
openExternalUri(resolvedUri: Uri, ctx: OpenExternalUriContext, token: CancellationToken): Thenable<void> | void;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Additional information about the uri being opened.
|
|
112
|
-
*/
|
|
113
|
-
export interface OpenExternalUriContext {
|
|
114
|
-
/**
|
|
115
|
-
* The uri that triggered the open.
|
|
116
|
-
*
|
|
117
|
-
* This is the original uri that the user clicked on or that was passed to `openExternal.`
|
|
118
|
-
* Due to port forwarding, this may not match the `resolvedUri` passed to `openExternalUri`.
|
|
119
|
-
*/
|
|
120
|
-
readonly sourceUri: Uri;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Additional metadata about a registered `ExternalUriOpener`.
|
|
125
|
-
*/
|
|
126
|
-
interface ExternalUriOpenerMetadata {
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* List of uri schemes the opener is triggered for.
|
|
130
|
-
*
|
|
131
|
-
* Currently only `http` and `https` are supported.
|
|
132
|
-
*/
|
|
133
|
-
readonly schemes: readonly string[];
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Text displayed to the user that explains what the opener does.
|
|
137
|
-
*
|
|
138
|
-
* For example, 'Open in browser preview'
|
|
139
|
-
*/
|
|
140
|
-
readonly label: string;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
export namespace window {
|
|
144
|
-
/**
|
|
145
|
-
* Register a new `ExternalUriOpener`.
|
|
146
|
-
*
|
|
147
|
-
* When a uri is about to be opened, an `onOpenExternalUri:SCHEME` activation event is fired.
|
|
148
|
-
*
|
|
149
|
-
* @param id Unique id of the opener, such as `myExtension.browserPreview`. This is used in settings
|
|
150
|
-
* and commands to identify the opener.
|
|
151
|
-
* @param opener Opener to register.
|
|
152
|
-
* @param metadata Additional information about the opener.
|
|
153
|
-
*
|
|
154
|
-
* @returns Disposable that unregisters the opener.
|
|
155
|
-
*/
|
|
156
|
-
export function registerExternalUriOpener(id: string, opener: ExternalUriOpener, metadata: ExternalUriOpenerMetadata): Disposable;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2023 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-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
/*---------------------------------------------------------------------------------------------
|
|
18
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
19
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
20
|
+
*--------------------------------------------------------------------------------------------*/
|
|
21
|
+
// code copied and modified from https://github.com/microsoft/vscode/blob/1.77.0/src/vscode-dts/vscode.proposed.externalUriOpener.d.ts
|
|
22
|
+
|
|
23
|
+
export module '@theia/plugin' {
|
|
24
|
+
/**
|
|
25
|
+
* Details if an `ExternalUriOpener` can open a uri.
|
|
26
|
+
*
|
|
27
|
+
* The priority is also used to rank multiple openers against each other and determine
|
|
28
|
+
* if an opener should be selected automatically or if the user should be prompted to
|
|
29
|
+
* select an opener.
|
|
30
|
+
*
|
|
31
|
+
* The editor will try to use the best available opener, as sorted by `ExternalUriOpenerPriority`.
|
|
32
|
+
* If there are multiple potential "best" openers for a URI, then the user will be prompted
|
|
33
|
+
* to select an opener.
|
|
34
|
+
*/
|
|
35
|
+
export enum ExternalUriOpenerPriority {
|
|
36
|
+
/**
|
|
37
|
+
* The opener is disabled and will never be shown to users.
|
|
38
|
+
*
|
|
39
|
+
* Note that the opener can still be used if the user specifically
|
|
40
|
+
* configures it in their settings.
|
|
41
|
+
*/
|
|
42
|
+
None = 0,
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The opener can open the uri but will not cause a prompt on its own
|
|
46
|
+
* since the editor always contributes a built-in `Default` opener.
|
|
47
|
+
*/
|
|
48
|
+
Option = 1,
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The opener can open the uri.
|
|
52
|
+
*
|
|
53
|
+
* The editor's built-in opener has `Default` priority. This means that any additional `Default`
|
|
54
|
+
* openers will cause the user to be prompted to select from a list of all potential openers.
|
|
55
|
+
*/
|
|
56
|
+
Default = 2,
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The opener can open the uri and should be automatically selected over any
|
|
60
|
+
* default openers, include the built-in one from the editor.
|
|
61
|
+
*
|
|
62
|
+
* A preferred opener will be automatically selected if no other preferred openers
|
|
63
|
+
* are available. If multiple preferred openers are available, then the user
|
|
64
|
+
* is shown a prompt with all potential openers (not just preferred openers).
|
|
65
|
+
*/
|
|
66
|
+
Preferred = 3,
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Handles opening uris to external resources, such as http(s) links.
|
|
71
|
+
*
|
|
72
|
+
* Extensions can implement an `ExternalUriOpener` to open `http` links to a webserver
|
|
73
|
+
* inside of the editor instead of having the link be opened by the web browser.
|
|
74
|
+
*
|
|
75
|
+
* Currently openers may only be registered for `http` and `https` uris.
|
|
76
|
+
*/
|
|
77
|
+
export interface ExternalUriOpener {
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Check if the opener can open a uri.
|
|
81
|
+
*
|
|
82
|
+
* @param uri The uri being opened. This is the uri that the user clicked on. It has
|
|
83
|
+
* not yet gone through port forwarding.
|
|
84
|
+
* @param token Cancellation token indicating that the result is no longer needed.
|
|
85
|
+
*
|
|
86
|
+
* @return Priority indicating if the opener can open the external uri.
|
|
87
|
+
*/
|
|
88
|
+
canOpenExternalUri(uri: Uri, token: CancellationToken): ExternalUriOpenerPriority | Thenable<ExternalUriOpenerPriority>;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Open a uri.
|
|
92
|
+
*
|
|
93
|
+
* This is invoked when:
|
|
94
|
+
*
|
|
95
|
+
* - The user clicks a link which does not have an assigned opener. In this case, first `canOpenExternalUri`
|
|
96
|
+
* is called and if the user selects this opener, then `openExternalUri` is called.
|
|
97
|
+
* - The user sets the default opener for a link in their settings and then visits a link.
|
|
98
|
+
*
|
|
99
|
+
* @param resolvedUri The uri to open. This uri may have been transformed by port forwarding, so it
|
|
100
|
+
* may not match the original uri passed to `canOpenExternalUri`. Use `ctx.originalUri` to check the
|
|
101
|
+
* original uri.
|
|
102
|
+
* @param ctx Additional information about the uri being opened.
|
|
103
|
+
* @param token Cancellation token indicating that opening has been canceled.
|
|
104
|
+
*
|
|
105
|
+
* @return Thenable indicating that the opening has completed.
|
|
106
|
+
*/
|
|
107
|
+
openExternalUri(resolvedUri: Uri, ctx: OpenExternalUriContext, token: CancellationToken): Thenable<void> | void;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Additional information about the uri being opened.
|
|
112
|
+
*/
|
|
113
|
+
export interface OpenExternalUriContext {
|
|
114
|
+
/**
|
|
115
|
+
* The uri that triggered the open.
|
|
116
|
+
*
|
|
117
|
+
* This is the original uri that the user clicked on or that was passed to `openExternal.`
|
|
118
|
+
* Due to port forwarding, this may not match the `resolvedUri` passed to `openExternalUri`.
|
|
119
|
+
*/
|
|
120
|
+
readonly sourceUri: Uri;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Additional metadata about a registered `ExternalUriOpener`.
|
|
125
|
+
*/
|
|
126
|
+
interface ExternalUriOpenerMetadata {
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* List of uri schemes the opener is triggered for.
|
|
130
|
+
*
|
|
131
|
+
* Currently only `http` and `https` are supported.
|
|
132
|
+
*/
|
|
133
|
+
readonly schemes: readonly string[];
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Text displayed to the user that explains what the opener does.
|
|
137
|
+
*
|
|
138
|
+
* For example, 'Open in browser preview'
|
|
139
|
+
*/
|
|
140
|
+
readonly label: string;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export namespace window {
|
|
144
|
+
/**
|
|
145
|
+
* Register a new `ExternalUriOpener`.
|
|
146
|
+
*
|
|
147
|
+
* When a uri is about to be opened, an `onOpenExternalUri:SCHEME` activation event is fired.
|
|
148
|
+
*
|
|
149
|
+
* @param id Unique id of the opener, such as `myExtension.browserPreview`. This is used in settings
|
|
150
|
+
* and commands to identify the opener.
|
|
151
|
+
* @param opener Opener to register.
|
|
152
|
+
* @param metadata Additional information about the opener.
|
|
153
|
+
*
|
|
154
|
+
* @returns Disposable that unregisters the opener.
|
|
155
|
+
*/
|
|
156
|
+
export function registerExternalUriOpener(id: string, opener: ExternalUriOpener, metadata: ExternalUriOpenerMetadata): Disposable;
|
|
157
|
+
}
|
|
158
|
+
}
|