@theia/plugin 1.39.0 → 1.40.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theia/plugin",
3
- "version": "1.39.0",
3
+ "version": "1.40.0",
4
4
  "description": "Theia - Plugin API",
5
5
  "types": "./src/theia.d.ts",
6
6
  "publishConfig": {
@@ -27,10 +27,10 @@
27
27
  "watch": "theiaext watch"
28
28
  },
29
29
  "devDependencies": {
30
- "@theia/ext-scripts": "1.39.0"
30
+ "@theia/ext-scripts": "1.40.0"
31
31
  },
32
32
  "nyc": {
33
33
  "extends": "../../configs/nyc.json"
34
34
  },
35
- "gitHead": "a5e754cd31e74d50031449d42347d65a9f3581d9"
35
+ "gitHead": "b2c84f963c24bde22dbdecd8c506eccc0768f400"
36
36
  }
package/src/theia.d.ts CHANGED
@@ -22,9 +22,11 @@
22
22
  *--------------------------------------------------------------------------------------------*/
23
23
 
24
24
  import './theia-extra';
25
+ import './theia.proposed.canonicalUriProvider';
25
26
  import './theia.proposed.customEditorMove';
26
27
  import './theia.proposed.diffCommand';
27
28
  import './theia.proposed.documentPaste';
29
+ import './theia.proposed.dropMetadata';
28
30
  import './theia.proposed.editSessionIdentityProvider';
29
31
  import './theia.proposed.extensionsAny';
30
32
  import './theia.proposed.externalUriOpener';
@@ -33,6 +35,7 @@ import './theia.proposed.fsChunks';
33
35
  import './theia.proposed.profileContentHandlers';
34
36
  import './theia.proposed.resolvers';
35
37
  import './theia.proposed.scmValidation';
38
+ import './theia.proposed.shareProvider';
36
39
  import './theia.proposed.terminalQuickFixProvider';
37
40
  import './theia.proposed.textSearchProvider';
38
41
  import './theia.proposed.timeline';
@@ -12627,6 +12630,9 @@ export module '@theia/plugin' {
12627
12630
 
12628
12631
  /** Controls whether the terminal is cleared before executing the task. */
12629
12632
  clear?: boolean;
12633
+
12634
+ /** Controls whether the terminal is closed after executing the task. */
12635
+ close?: boolean;
12630
12636
  }
12631
12637
 
12632
12638
  /**
@@ -13665,6 +13671,17 @@ export module '@theia/plugin' {
13665
13671
  readonly label: string;
13666
13672
  }
13667
13673
 
13674
+ /**
13675
+ * Optional options to be used when calling {@link authentication.getSession} with the flag `forceNewSession`.
13676
+ */
13677
+ export interface AuthenticationForceNewSessionOptions {
13678
+ /**
13679
+ * An optional message that will be displayed to the user when we ask to re-authenticate. Providing additional context
13680
+ * as to why you are asking a user to re-authenticate can help increase the odds that they will accept.
13681
+ */
13682
+ detail?: string;
13683
+ }
13684
+
13668
13685
  /**
13669
13686
  * Options to be used when getting an {@link AuthenticationSession AuthenticationSession} from an {@link AuthenticationProvider AuthenticationProvider}.
13670
13687
  */
@@ -13699,7 +13716,7 @@ export module '@theia/plugin' {
13699
13716
  *
13700
13717
  * Defaults to false.
13701
13718
  */
13702
- forceNewSession?: boolean | { detail: string };
13719
+ forceNewSession?: boolean | AuthenticationForceNewSessionOptions;
13703
13720
 
13704
13721
  /**
13705
13722
  * Whether we should show the indication to sign in in the Accounts menu.
@@ -0,0 +1,64 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2023 STMicroelectronics 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
+ * Copyright (c) Microsoft Corporation. All rights reserved.
18
+ * Licensed under the MIT License. See License.txt in the project root for license information.
19
+ *--------------------------------------------------------------------------------------------*/
20
+
21
+ // code copied and modified from https://github.com/microsoft/vscode/blob/1.79.0/src/vscode-dts/vscode.proposed.canonicalUriProvider.d.ts
22
+
23
+ export module '@theia/plugin' {
24
+
25
+ // https://github.com/microsoft/vscode/issues/180582
26
+
27
+ export namespace workspace {
28
+ /**
29
+ *
30
+ * @param scheme The URI scheme that this provider can provide canonical URIs for.
31
+ * A canonical URI represents the conversion of a resource's alias into a source of truth URI.
32
+ * Multiple aliases may convert to the same source of truth URI.
33
+ * @param provider A provider which can convert URIs of scheme @param scheme to
34
+ * a canonical URI which is stable across machines.
35
+ */
36
+ export function registerCanonicalUriProvider(scheme: string, provider: CanonicalUriProvider): Disposable;
37
+
38
+ /**
39
+ *
40
+ * @param uri The URI to provide a canonical URI for.
41
+ * @param token A cancellation token for the request.
42
+ */
43
+ export function getCanonicalUri(uri: Uri, options: CanonicalUriRequestOptions, token: CancellationToken): ProviderResult<Uri>;
44
+ }
45
+
46
+ export interface CanonicalUriProvider {
47
+ /**
48
+ *
49
+ * @param uri The URI to provide a canonical URI for.
50
+ * @param options Options that the provider should honor in the URI it returns.
51
+ * @param token A cancellation token for the request.
52
+ * @returns The canonical URI for the requested URI or undefined if no canonical URI can be provided.
53
+ */
54
+ provideCanonicalUri(uri: Uri, options: CanonicalUriRequestOptions, token: CancellationToken): ProviderResult<Uri>;
55
+ }
56
+
57
+ export interface CanonicalUriRequestOptions {
58
+ /**
59
+ *
60
+ * The desired scheme of the canonical URI.
61
+ */
62
+ targetScheme: string;
63
+ }
64
+ }
@@ -18,7 +18,7 @@
18
18
  * Copyright (c) Microsoft Corporation. All rights reserved.
19
19
  * Licensed under the MIT License. See License.txt in the project root for license information.
20
20
  *--------------------------------------------------------------------------------------------*/
21
- // code copied and modified from https://github.com/microsoft/vscode/blob/1.77.0/src/vscode-dts/vscode.proposed.documentPaste.d.ts
21
+ // code copied and modified from https://github.com/microsoft/vscode/blob/1.79.0/src/vscode-dts/vscode.proposed.documentPaste.d.ts
22
22
 
23
23
  export module '@theia/plugin' {
24
24
 
@@ -52,13 +52,32 @@ export module '@theia/plugin' {
52
52
  *
53
53
  * @return Optional workspace edit that applies the paste. Return undefined to use standard pasting.
54
54
  */
55
- provideDocumentPasteEdits(document: TextDocument, ranges: readonly Range[], dataTransfer: DataTransfer, token: CancellationToken): ProviderResult<DocumentPasteEdit>;
55
+ provideDocumentPasteEdits?(document: TextDocument, ranges: readonly Range[], dataTransfer: DataTransfer, token: CancellationToken): ProviderResult<DocumentPasteEdit>;
56
56
  }
57
57
 
58
58
  /**
59
59
  * An operation applied on paste
60
60
  */
61
61
  class DocumentPasteEdit {
62
+ /**
63
+ * Identifies the type of edit.
64
+ *
65
+ * This id should be unique within the extension but does not need to be unique across extensions.
66
+ */
67
+ id: string;
68
+
69
+ /**
70
+ * Human readable label that describes the edit.
71
+ */
72
+ label: string;
73
+
74
+ /**
75
+ * The relative priority of this edit. Higher priority items are shown first in the UI.
76
+ *
77
+ * Defaults to `0`.
78
+ */
79
+ priority?: number;
80
+
62
81
  /**
63
82
  * The text or snippet to insert at the pasted locations.
64
83
  */
@@ -71,17 +90,30 @@ export module '@theia/plugin' {
71
90
 
72
91
  /**
73
92
  * @param insertText The text or snippet to insert at the pasted locations.
93
+ *
94
+ * TODO: Reverse args, but this will break existing consumers :(
74
95
  */
75
- constructor(insertText: string | SnippetString);
96
+ constructor(insertText: string | SnippetString, id: string, label: string);
76
97
  }
77
98
 
78
99
  interface DocumentPasteProviderMetadata {
79
100
  /**
80
- * Mime types that `provideDocumentPasteEdits` should be invoked for.
101
+ * Mime types that {@link DocumentPasteEditProvider.prepareDocumentPaste provideDocumentPasteEdits} may add on copy.
102
+ */
103
+ readonly copyMimeTypes?: readonly string[];
104
+
105
+ /**
106
+ * Mime types that {@link DocumentPasteEditProvider.provideDocumentPasteEdits provideDocumentPasteEdits} should be invoked for.
107
+ *
108
+ * This can either be an exact mime type such as `image/png`, or a wildcard pattern such as `image/*`.
109
+ *
110
+ * Use `text/uri-list` for resources dropped from the explorer or other tree views in the workbench.
81
111
  *
82
- * Use the special `files` mimetype to indicate the provider should be invoked if any files are present in the `DataTransfer`.
112
+ * Use `files` to indicate that the provider should be invoked if any {@link DataTransferFile files} are present in the {@link DataTransfer}.
113
+ * Note that {@link DataTransferFile} entries are only created when dropping content from outside the editor, such as
114
+ * from the operating system.
83
115
  */
84
- readonly pasteMimeTypes: readonly string[];
116
+ readonly pasteMimeTypes?: readonly string[];
85
117
  }
86
118
 
87
119
  namespace languages {
@@ -0,0 +1,66 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2023 TypeFox and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ /*---------------------------------------------------------------------------------------------
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.79.0/src/vscode-dts/vscode.proposed.dropMetadata.d.ts
22
+
23
+ export module '@theia/plugin' {
24
+
25
+ // https://github.com/microsoft/vscode/issues/179430
26
+
27
+ export interface DocumentDropEdit {
28
+ /**
29
+ * Identifies the type of edit.
30
+ *
31
+ * This id should be unique within the extension but does not need to be unique across extensions.
32
+ */
33
+ id?: string;
34
+
35
+ /**
36
+ * The relative priority of this edit. Higher priority items are shown first in the UI.
37
+ *
38
+ * Defaults to `0`.
39
+ */
40
+ priority?: number;
41
+
42
+ /**
43
+ * Human readable label that describes the edit.
44
+ */
45
+ label?: string;
46
+ }
47
+
48
+ export interface DocumentDropEditProviderMetadata {
49
+ /**
50
+ * List of data transfer types that the provider supports.
51
+ *
52
+ * This can either be an exact mime type such as `image/png`, or a wildcard pattern such as `image/*`.
53
+ *
54
+ * Use `text/uri-list` for resources dropped from the explorer or other tree views in the workbench.
55
+ *
56
+ * Use `files` to indicate that the provider should be invoked if any {@link DataTransferFile files} are present in the {@link DataTransfer}.
57
+ * Note that {@link DataTransferFile} entries are only created when dropping content from outside the editor, such as
58
+ * from the operating system.
59
+ */
60
+ readonly dropMimeTypes: readonly string[];
61
+ }
62
+
63
+ export namespace languages {
64
+ export function registerDocumentDropEditProvider(selector: DocumentSelector, provider: DocumentDropEditProvider, metadata?: DocumentDropEditProviderMetadata): Disposable;
65
+ }
66
+ }
@@ -0,0 +1,92 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2023 STMicroelectronics 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
+
22
+ // code copied and modified from https://github.com/microsoft/vscode/blob/release/1.79/src/vscode-dts/vscode.proposed.shareProvider.d.ts
23
+
24
+ // https://github.com/microsoft/vscode/issues/176316 @joyceerhl
25
+
26
+ export module '@theia/plugin' {
27
+
28
+ /**
29
+ * Data about an item which can be shared.
30
+ */
31
+ export interface ShareableItem {
32
+ /**
33
+ * A resource in the workspace that can be shared.
34
+ */
35
+ resourceUri: Uri;
36
+
37
+ /**
38
+ * If present, a selection within the `resourceUri`.
39
+ */
40
+ selection?: Range;
41
+ }
42
+
43
+ /**
44
+ * A provider which generates share links for resources in the editor.
45
+ */
46
+ export interface ShareProvider {
47
+
48
+ /**
49
+ * A unique ID for the provider.
50
+ * This will be used to activate specific extensions contributing share providers if necessary.
51
+ */
52
+ readonly id: string;
53
+
54
+ /**
55
+ * A label which will be used to present this provider's options in the UI.
56
+ */
57
+ readonly label: string;
58
+
59
+ /**
60
+ * The order in which the provider should be listed in the UI when there are multiple providers.
61
+ */
62
+ readonly priority: number;
63
+
64
+ /**
65
+ *
66
+ * @param item Data about an item which can be shared.
67
+ * @param token A cancellation token.
68
+ * @returns A {@link Uri} representing an external link or sharing text. The provider result
69
+ * will be copied to the user's clipboard and presented in a confirmation dialog.
70
+ */
71
+ provideShare(item: ShareableItem, token: CancellationToken): ProviderResult<Uri | string>;
72
+ }
73
+
74
+ export namespace window {
75
+
76
+ /**
77
+ * Register a share provider. An extension may register multiple share providers.
78
+ * There may be multiple share providers for the same {@link ShareableItem}.
79
+ * @param selector A document selector to filter whether the provider should be shown for a {@link ShareableItem}.
80
+ * @param provider A share provider.
81
+ */
82
+ export function registerShareProvider(selector: DocumentSelector, provider: ShareProvider): Disposable;
83
+ }
84
+
85
+ export interface TreeItem {
86
+
87
+ /**
88
+ * An optional property which, when set, inlines a `Share` option in the context menu for this tree item.
89
+ */
90
+ shareableItem?: ShareableItem;
91
+ }
92
+ }