@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,316 +1,316 @@
|
|
|
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.79.0/src/vscode-dts/vscode.proposed.documentPaste.d.ts
|
|
22
|
-
|
|
23
|
-
export module '@theia/plugin' {
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Identifies a {@linkcode DocumentDropEdit} or {@linkcode DocumentPasteEdit}
|
|
27
|
-
*/
|
|
28
|
-
class DocumentDropOrPasteEditKind {
|
|
29
|
-
static readonly Empty: DocumentDropOrPasteEditKind;
|
|
30
|
-
|
|
31
|
-
private constructor(value: string);
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* The raw string value of the kind.
|
|
35
|
-
*/
|
|
36
|
-
readonly value: string;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Create a new kind by appending additional scopes to the current kind.
|
|
40
|
-
*
|
|
41
|
-
* Does not modify the current kind.
|
|
42
|
-
*/
|
|
43
|
-
append(...parts: string[]): DocumentDropOrPasteEditKind;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Checks if this kind intersects `other`.
|
|
47
|
-
*
|
|
48
|
-
* The kind `"text.plain"` for example intersects `text`, `"text.plain"` and `"text.plain.list"`,
|
|
49
|
-
* but not `"unicorn"`, or `"textUnicorn.plain"`.
|
|
50
|
-
*
|
|
51
|
-
* @param other Kind to check.
|
|
52
|
-
*/
|
|
53
|
-
intersects(other: DocumentDropOrPasteEditKind): boolean;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Checks if `other` is a sub-kind of this `DocumentDropOrPasteEditKind`.
|
|
57
|
-
*
|
|
58
|
-
* The kind `"text.plain"` for example contains `"text.plain"` and `"text.plain.list"`,
|
|
59
|
-
* but not `"text"` or `"unicorn.text.plain"`.
|
|
60
|
-
*
|
|
61
|
-
* @param other Kind to check.
|
|
62
|
-
*/
|
|
63
|
-
contains(other: DocumentDropOrPasteEditKind): boolean;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* The reason why paste edits were requested.
|
|
68
|
-
*/
|
|
69
|
-
export enum DocumentPasteTriggerKind {
|
|
70
|
-
/**
|
|
71
|
-
* Pasting was requested as part of a normal paste operation.
|
|
72
|
-
*/
|
|
73
|
-
Automatic = 0,
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Pasting was requested by the user with the `paste as` command.
|
|
77
|
-
*/
|
|
78
|
-
PasteAs = 1,
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Additional information about the paste operation.
|
|
83
|
-
*/
|
|
84
|
-
|
|
85
|
-
export interface DocumentPasteEditContext {
|
|
86
|
-
/**
|
|
87
|
-
* Requested kind of paste edits to return.
|
|
88
|
-
*/
|
|
89
|
-
readonly only: DocumentDropOrPasteEditKind | undefined;
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* The reason why paste edits were requested.
|
|
93
|
-
*/
|
|
94
|
-
readonly triggerKind: DocumentPasteTriggerKind;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Provider invoked when the user copies or pastes in a {@linkcode TextDocument}.
|
|
99
|
-
*/
|
|
100
|
-
interface DocumentPasteEditProvider<T extends DocumentPasteEdit = DocumentPasteEdit> {
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Optional method invoked after the user copies from a {@link TextEditor text editor}.
|
|
104
|
-
*
|
|
105
|
-
* This allows the provider to attach metadata about the copied text to the {@link DataTransfer}. This data
|
|
106
|
-
* transfer is then passed back to providers in {@linkcode provideDocumentPasteEdits}.
|
|
107
|
-
*
|
|
108
|
-
* Note that currently any changes to the {@linkcode DataTransfer} are isolated to the current editor window.
|
|
109
|
-
* This means that any added metadata cannot be seen by other editor windows or by other applications.
|
|
110
|
-
*
|
|
111
|
-
* @param document Text document where the copy took place.
|
|
112
|
-
* @param ranges Ranges being copied in {@linkcode document}.
|
|
113
|
-
* @param dataTransfer The data transfer associated with the copy. You can store additional values on this for
|
|
114
|
-
* later use in {@linkcode provideDocumentPasteEdits}. This object is only valid for the duration of this method.
|
|
115
|
-
* @param token A cancellation token.
|
|
116
|
-
*
|
|
117
|
-
* @return Optional thenable that resolves when all changes to the `dataTransfer` are complete.
|
|
118
|
-
*/
|
|
119
|
-
prepareDocumentPaste?(document: TextDocument, ranges: readonly Range[], dataTransfer: DataTransfer, token: CancellationToken): void | Thenable<void>;
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Invoked before the user pastes into a {@link TextEditor text editor}.
|
|
123
|
-
*
|
|
124
|
-
* Returned edits can replace the standard pasting behavior.
|
|
125
|
-
*
|
|
126
|
-
* @param document Document being pasted into
|
|
127
|
-
* @param ranges Range in the {@linkcode document} to paste into.
|
|
128
|
-
* @param dataTransfer The {@link DataTransfer data transfer} associated with the paste. This object is only
|
|
129
|
-
* valid for the duration of the paste operation.
|
|
130
|
-
* @param context Additional context for the paste.
|
|
131
|
-
* @param token A cancellation token.
|
|
132
|
-
*
|
|
133
|
-
* @return Set of potential {@link DocumentPasteEdit edits} that can apply the paste. Only a single returned
|
|
134
|
-
* {@linkcode DocumentPasteEdit} is applied at a time. If multiple edits are returned from all providers, then
|
|
135
|
-
* the first is automatically applied and a widget is shown that lets the user switch to the other edits.
|
|
136
|
-
*/
|
|
137
|
-
provideDocumentPasteEdits?(document: TextDocument, ranges: readonly Range[], dataTransfer: DataTransfer, context: DocumentPasteEditContext, token: CancellationToken):
|
|
138
|
-
ProviderResult<T[]>;
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Optional method which fills in the {@linkcode DocumentPasteEdit.additionalEdit} before the edit is applied.
|
|
142
|
-
*
|
|
143
|
-
* This is called once per edit and should be used if generating the complete edit may take a long time.
|
|
144
|
-
* Resolve can only be used to change {@linkcode DocumentPasteEdit.additionalEdit}.
|
|
145
|
-
*
|
|
146
|
-
* @param pasteEdit The {@linkcode DocumentPasteEdit} to resolve.
|
|
147
|
-
* @param token A cancellation token.
|
|
148
|
-
*
|
|
149
|
-
* @returns The resolved paste edit or a thenable that resolves to such. It is OK to return the given
|
|
150
|
-
* `pasteEdit`. If no result is returned, the given `pasteEdit` is used.
|
|
151
|
-
*/
|
|
152
|
-
resolveDocumentPasteEdit?(pasteEdit: T, token: CancellationToken): ProviderResult<T>;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* An edit the applies a paste operation.
|
|
157
|
-
*/
|
|
158
|
-
class DocumentPasteEdit {
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Human readable label that describes the edit.
|
|
162
|
-
*/
|
|
163
|
-
title: string;
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* {@link DocumentDropOrPasteEditKind Kind} of the edit.
|
|
167
|
-
*/
|
|
168
|
-
kind: DocumentDropOrPasteEditKind;
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* The text or snippet to insert at the pasted locations.
|
|
172
|
-
*
|
|
173
|
-
* If your edit requires more advanced insertion logic, set this to an empty string and provide an {@link DocumentPasteEdit.additionalEdit additional edit} instead.
|
|
174
|
-
*/
|
|
175
|
-
insertText: string | SnippetString;
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* An optional additional edit to apply on paste.
|
|
179
|
-
*/
|
|
180
|
-
additionalEdit?: WorkspaceEdit;
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Controls ordering when multiple paste edits can potentially be applied.
|
|
184
|
-
*
|
|
185
|
-
* If this edit yields to another, it will be shown lower in the list of possible paste edits shown to the user.
|
|
186
|
-
*/
|
|
187
|
-
yieldTo?: readonly DocumentDropOrPasteEditKind[];
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* Create a new paste edit.
|
|
191
|
-
*
|
|
192
|
-
* @param insertText The text or snippet to insert at the pasted locations.
|
|
193
|
-
* @param title Human readable label that describes the edit.
|
|
194
|
-
* @param kind {@link DocumentDropOrPasteEditKind Kind} of the edit.
|
|
195
|
-
*/
|
|
196
|
-
constructor(insertText: string | SnippetString, title: string, kind: DocumentDropOrPasteEditKind);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Provides additional metadata about how a {@linkcode DocumentPasteEditProvider} works.
|
|
201
|
-
*/
|
|
202
|
-
interface DocumentPasteProviderMetadata {
|
|
203
|
-
/**
|
|
204
|
-
* List of {@link DocumentDropOrPasteEditKind kinds} that the provider may return in
|
|
205
|
-
* {@linkcode DocumentPasteEditProvider.provideDocumentPasteEdits provideDocumentPasteEdits}.
|
|
206
|
-
*
|
|
207
|
-
* This is used to filter out providers when a specific {@link DocumentDropOrPasteEditKind kind} of edit is requested.
|
|
208
|
-
*/
|
|
209
|
-
readonly providedPasteEditKinds: readonly DocumentDropOrPasteEditKind[];
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* Mime types that {@linkcode DocumentPasteEditProvider.prepareDocumentPaste prepareDocumentPaste} may add on copy.
|
|
213
|
-
*/
|
|
214
|
-
readonly copyMimeTypes?: readonly string[];
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Mime types that {@linkcode DocumentPasteEditProvider.provideDocumentPasteEdits provideDocumentPasteEdits} should be invoked for.
|
|
218
|
-
*
|
|
219
|
-
* This can either be an exact mime type such as `image/png`, or a wildcard pattern such as `image/*`.
|
|
220
|
-
*
|
|
221
|
-
* Use `text/uri-list` for resources dropped from the explorer or other tree views in the workbench.
|
|
222
|
-
*
|
|
223
|
-
* Use `files` to indicate that the provider should be invoked if any {@link DataTransferFile files} are present in the {@linkcode DataTransfer}.
|
|
224
|
-
* Note that {@linkcode DataTransferFile} entries are only created when pasting content from outside the editor, such as
|
|
225
|
-
* from the operating system.
|
|
226
|
-
*/
|
|
227
|
-
readonly pasteMimeTypes?: readonly string[];
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* TODO on finalization:
|
|
232
|
-
* - Add ctor(insertText: string | SnippetString, title?: string, kind?: DocumentDropOrPasteEditKind); Can't be done as this is an extension to an existing class
|
|
233
|
-
*/
|
|
234
|
-
|
|
235
|
-
export interface DocumentDropEdit {
|
|
236
|
-
/**
|
|
237
|
-
* Human readable label that describes the edit.
|
|
238
|
-
*/
|
|
239
|
-
title?: string;
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* {@link DocumentDropOrPasteEditKind Kind} of the edit.
|
|
243
|
-
*/
|
|
244
|
-
kind: DocumentDropOrPasteEditKind;
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Controls the ordering or multiple edits. If this provider yield to edits, it will be shown lower in the list.
|
|
248
|
-
*/
|
|
249
|
-
yieldTo?: readonly DocumentDropOrPasteEditKind[];
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
export interface DocumentDropEditProvider<T extends DocumentDropEdit = DocumentDropEdit> {
|
|
253
|
-
// Overload that allows returning multiple edits
|
|
254
|
-
// Will be merged in on finalization
|
|
255
|
-
provideDocumentDropEdits(document: TextDocument, position: Position, dataTransfer: DataTransfer, token: CancellationToken):
|
|
256
|
-
ProviderResult<DocumentDropEdit | DocumentDropEdit[]>;
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* Optional method which fills in the {@linkcode DocumentDropEdit.additionalEdit} before the edit is applied.
|
|
260
|
-
*
|
|
261
|
-
* This is called once per edit and should be used if generating the complete edit may take a long time.
|
|
262
|
-
* Resolve can only be used to change {@link DocumentDropEdit.additionalEdit}.
|
|
263
|
-
*
|
|
264
|
-
* @param pasteEdit The {@linkcode DocumentDropEdit} to resolve.
|
|
265
|
-
* @param token A cancellation token.
|
|
266
|
-
*
|
|
267
|
-
* @returns The resolved edit or a thenable that resolves to such. It is OK to return the given
|
|
268
|
-
* `edit`. If no result is returned, the given `edit` is used.
|
|
269
|
-
*/
|
|
270
|
-
resolveDocumentDropEdit?(edit: T, token: CancellationToken): ProviderResult<T>;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
* Provides additional metadata about how a {@linkcode DocumentDropEditProvider} works.
|
|
275
|
-
*/
|
|
276
|
-
export interface DocumentDropEditProviderMetadata {
|
|
277
|
-
/**
|
|
278
|
-
* List of {@link DocumentDropOrPasteEditKind kinds} that the provider may return in {@linkcode DocumentDropEditProvider.provideDocumentDropEdits provideDocumentDropEdits}.
|
|
279
|
-
*
|
|
280
|
-
* This is used to filter out providers when a specific {@link DocumentDropOrPasteEditKind kind} of edit is requested.
|
|
281
|
-
*/
|
|
282
|
-
readonly providedDropEditKinds?: readonly DocumentDropOrPasteEditKind[];
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* List of {@link DataTransfer} mime types that the provider can handle.
|
|
286
|
-
*
|
|
287
|
-
* This can either be an exact mime type such as `image/png`, or a wildcard pattern such as `image/*`.
|
|
288
|
-
*
|
|
289
|
-
* Use `text/uri-list` for resources dropped from the explorer or other tree views in the workbench.
|
|
290
|
-
*
|
|
291
|
-
* Use `files` to indicate that the provider should be invoked if any {@link DataTransferFile files} are present in the {@link DataTransfer}.
|
|
292
|
-
* Note that {@link DataTransferFile} entries are only created when dropping content from outside the editor, such as
|
|
293
|
-
* from the operating system.
|
|
294
|
-
*/
|
|
295
|
-
readonly dropMimeTypes: readonly string[];
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
namespace languages {
|
|
299
|
-
/**
|
|
300
|
-
* Registers a new {@linkcode DocumentPasteEditProvider}.
|
|
301
|
-
*
|
|
302
|
-
* @param selector A selector that defines the documents this provider applies to.
|
|
303
|
-
* @param provider A paste editor provider.
|
|
304
|
-
* @param metadata Additional metadata about the provider.
|
|
305
|
-
*
|
|
306
|
-
* @returns A {@link Disposable} that unregisters this provider when disposed of.
|
|
307
|
-
* @stubbed
|
|
308
|
-
*/
|
|
309
|
-
export function registerDocumentPasteEditProvider(selector: DocumentSelector, provider: DocumentPasteEditProvider, metadata: DocumentPasteProviderMetadata): Disposable;
|
|
310
|
-
|
|
311
|
-
/**
|
|
312
|
-
* Overload which adds extra metadata. Will be removed on finalization.
|
|
313
|
-
*/
|
|
314
|
-
export function registerDocumentDropEditProvider(selector: DocumentSelector, provider: DocumentDropEditProvider, metadata?: DocumentDropEditProviderMetadata): Disposable;
|
|
315
|
-
}
|
|
316
|
-
}
|
|
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.79.0/src/vscode-dts/vscode.proposed.documentPaste.d.ts
|
|
22
|
+
|
|
23
|
+
export module '@theia/plugin' {
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Identifies a {@linkcode DocumentDropEdit} or {@linkcode DocumentPasteEdit}
|
|
27
|
+
*/
|
|
28
|
+
class DocumentDropOrPasteEditKind {
|
|
29
|
+
static readonly Empty: DocumentDropOrPasteEditKind;
|
|
30
|
+
|
|
31
|
+
private constructor(value: string);
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The raw string value of the kind.
|
|
35
|
+
*/
|
|
36
|
+
readonly value: string;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Create a new kind by appending additional scopes to the current kind.
|
|
40
|
+
*
|
|
41
|
+
* Does not modify the current kind.
|
|
42
|
+
*/
|
|
43
|
+
append(...parts: string[]): DocumentDropOrPasteEditKind;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Checks if this kind intersects `other`.
|
|
47
|
+
*
|
|
48
|
+
* The kind `"text.plain"` for example intersects `text`, `"text.plain"` and `"text.plain.list"`,
|
|
49
|
+
* but not `"unicorn"`, or `"textUnicorn.plain"`.
|
|
50
|
+
*
|
|
51
|
+
* @param other Kind to check.
|
|
52
|
+
*/
|
|
53
|
+
intersects(other: DocumentDropOrPasteEditKind): boolean;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Checks if `other` is a sub-kind of this `DocumentDropOrPasteEditKind`.
|
|
57
|
+
*
|
|
58
|
+
* The kind `"text.plain"` for example contains `"text.plain"` and `"text.plain.list"`,
|
|
59
|
+
* but not `"text"` or `"unicorn.text.plain"`.
|
|
60
|
+
*
|
|
61
|
+
* @param other Kind to check.
|
|
62
|
+
*/
|
|
63
|
+
contains(other: DocumentDropOrPasteEditKind): boolean;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The reason why paste edits were requested.
|
|
68
|
+
*/
|
|
69
|
+
export enum DocumentPasteTriggerKind {
|
|
70
|
+
/**
|
|
71
|
+
* Pasting was requested as part of a normal paste operation.
|
|
72
|
+
*/
|
|
73
|
+
Automatic = 0,
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Pasting was requested by the user with the `paste as` command.
|
|
77
|
+
*/
|
|
78
|
+
PasteAs = 1,
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Additional information about the paste operation.
|
|
83
|
+
*/
|
|
84
|
+
|
|
85
|
+
export interface DocumentPasteEditContext {
|
|
86
|
+
/**
|
|
87
|
+
* Requested kind of paste edits to return.
|
|
88
|
+
*/
|
|
89
|
+
readonly only: DocumentDropOrPasteEditKind | undefined;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* The reason why paste edits were requested.
|
|
93
|
+
*/
|
|
94
|
+
readonly triggerKind: DocumentPasteTriggerKind;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Provider invoked when the user copies or pastes in a {@linkcode TextDocument}.
|
|
99
|
+
*/
|
|
100
|
+
interface DocumentPasteEditProvider<T extends DocumentPasteEdit = DocumentPasteEdit> {
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Optional method invoked after the user copies from a {@link TextEditor text editor}.
|
|
104
|
+
*
|
|
105
|
+
* This allows the provider to attach metadata about the copied text to the {@link DataTransfer}. This data
|
|
106
|
+
* transfer is then passed back to providers in {@linkcode provideDocumentPasteEdits}.
|
|
107
|
+
*
|
|
108
|
+
* Note that currently any changes to the {@linkcode DataTransfer} are isolated to the current editor window.
|
|
109
|
+
* This means that any added metadata cannot be seen by other editor windows or by other applications.
|
|
110
|
+
*
|
|
111
|
+
* @param document Text document where the copy took place.
|
|
112
|
+
* @param ranges Ranges being copied in {@linkcode document}.
|
|
113
|
+
* @param dataTransfer The data transfer associated with the copy. You can store additional values on this for
|
|
114
|
+
* later use in {@linkcode provideDocumentPasteEdits}. This object is only valid for the duration of this method.
|
|
115
|
+
* @param token A cancellation token.
|
|
116
|
+
*
|
|
117
|
+
* @return Optional thenable that resolves when all changes to the `dataTransfer` are complete.
|
|
118
|
+
*/
|
|
119
|
+
prepareDocumentPaste?(document: TextDocument, ranges: readonly Range[], dataTransfer: DataTransfer, token: CancellationToken): void | Thenable<void>;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Invoked before the user pastes into a {@link TextEditor text editor}.
|
|
123
|
+
*
|
|
124
|
+
* Returned edits can replace the standard pasting behavior.
|
|
125
|
+
*
|
|
126
|
+
* @param document Document being pasted into
|
|
127
|
+
* @param ranges Range in the {@linkcode document} to paste into.
|
|
128
|
+
* @param dataTransfer The {@link DataTransfer data transfer} associated with the paste. This object is only
|
|
129
|
+
* valid for the duration of the paste operation.
|
|
130
|
+
* @param context Additional context for the paste.
|
|
131
|
+
* @param token A cancellation token.
|
|
132
|
+
*
|
|
133
|
+
* @return Set of potential {@link DocumentPasteEdit edits} that can apply the paste. Only a single returned
|
|
134
|
+
* {@linkcode DocumentPasteEdit} is applied at a time. If multiple edits are returned from all providers, then
|
|
135
|
+
* the first is automatically applied and a widget is shown that lets the user switch to the other edits.
|
|
136
|
+
*/
|
|
137
|
+
provideDocumentPasteEdits?(document: TextDocument, ranges: readonly Range[], dataTransfer: DataTransfer, context: DocumentPasteEditContext, token: CancellationToken):
|
|
138
|
+
ProviderResult<T[]>;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Optional method which fills in the {@linkcode DocumentPasteEdit.additionalEdit} before the edit is applied.
|
|
142
|
+
*
|
|
143
|
+
* This is called once per edit and should be used if generating the complete edit may take a long time.
|
|
144
|
+
* Resolve can only be used to change {@linkcode DocumentPasteEdit.additionalEdit}.
|
|
145
|
+
*
|
|
146
|
+
* @param pasteEdit The {@linkcode DocumentPasteEdit} to resolve.
|
|
147
|
+
* @param token A cancellation token.
|
|
148
|
+
*
|
|
149
|
+
* @returns The resolved paste edit or a thenable that resolves to such. It is OK to return the given
|
|
150
|
+
* `pasteEdit`. If no result is returned, the given `pasteEdit` is used.
|
|
151
|
+
*/
|
|
152
|
+
resolveDocumentPasteEdit?(pasteEdit: T, token: CancellationToken): ProviderResult<T>;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* An edit the applies a paste operation.
|
|
157
|
+
*/
|
|
158
|
+
class DocumentPasteEdit {
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Human readable label that describes the edit.
|
|
162
|
+
*/
|
|
163
|
+
title: string;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* {@link DocumentDropOrPasteEditKind Kind} of the edit.
|
|
167
|
+
*/
|
|
168
|
+
kind: DocumentDropOrPasteEditKind;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* The text or snippet to insert at the pasted locations.
|
|
172
|
+
*
|
|
173
|
+
* If your edit requires more advanced insertion logic, set this to an empty string and provide an {@link DocumentPasteEdit.additionalEdit additional edit} instead.
|
|
174
|
+
*/
|
|
175
|
+
insertText: string | SnippetString;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* An optional additional edit to apply on paste.
|
|
179
|
+
*/
|
|
180
|
+
additionalEdit?: WorkspaceEdit;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Controls ordering when multiple paste edits can potentially be applied.
|
|
184
|
+
*
|
|
185
|
+
* If this edit yields to another, it will be shown lower in the list of possible paste edits shown to the user.
|
|
186
|
+
*/
|
|
187
|
+
yieldTo?: readonly DocumentDropOrPasteEditKind[];
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Create a new paste edit.
|
|
191
|
+
*
|
|
192
|
+
* @param insertText The text or snippet to insert at the pasted locations.
|
|
193
|
+
* @param title Human readable label that describes the edit.
|
|
194
|
+
* @param kind {@link DocumentDropOrPasteEditKind Kind} of the edit.
|
|
195
|
+
*/
|
|
196
|
+
constructor(insertText: string | SnippetString, title: string, kind: DocumentDropOrPasteEditKind);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Provides additional metadata about how a {@linkcode DocumentPasteEditProvider} works.
|
|
201
|
+
*/
|
|
202
|
+
interface DocumentPasteProviderMetadata {
|
|
203
|
+
/**
|
|
204
|
+
* List of {@link DocumentDropOrPasteEditKind kinds} that the provider may return in
|
|
205
|
+
* {@linkcode DocumentPasteEditProvider.provideDocumentPasteEdits provideDocumentPasteEdits}.
|
|
206
|
+
*
|
|
207
|
+
* This is used to filter out providers when a specific {@link DocumentDropOrPasteEditKind kind} of edit is requested.
|
|
208
|
+
*/
|
|
209
|
+
readonly providedPasteEditKinds: readonly DocumentDropOrPasteEditKind[];
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Mime types that {@linkcode DocumentPasteEditProvider.prepareDocumentPaste prepareDocumentPaste} may add on copy.
|
|
213
|
+
*/
|
|
214
|
+
readonly copyMimeTypes?: readonly string[];
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Mime types that {@linkcode DocumentPasteEditProvider.provideDocumentPasteEdits provideDocumentPasteEdits} should be invoked for.
|
|
218
|
+
*
|
|
219
|
+
* This can either be an exact mime type such as `image/png`, or a wildcard pattern such as `image/*`.
|
|
220
|
+
*
|
|
221
|
+
* Use `text/uri-list` for resources dropped from the explorer or other tree views in the workbench.
|
|
222
|
+
*
|
|
223
|
+
* Use `files` to indicate that the provider should be invoked if any {@link DataTransferFile files} are present in the {@linkcode DataTransfer}.
|
|
224
|
+
* Note that {@linkcode DataTransferFile} entries are only created when pasting content from outside the editor, such as
|
|
225
|
+
* from the operating system.
|
|
226
|
+
*/
|
|
227
|
+
readonly pasteMimeTypes?: readonly string[];
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* TODO on finalization:
|
|
232
|
+
* - Add ctor(insertText: string | SnippetString, title?: string, kind?: DocumentDropOrPasteEditKind); Can't be done as this is an extension to an existing class
|
|
233
|
+
*/
|
|
234
|
+
|
|
235
|
+
export interface DocumentDropEdit {
|
|
236
|
+
/**
|
|
237
|
+
* Human readable label that describes the edit.
|
|
238
|
+
*/
|
|
239
|
+
title?: string;
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* {@link DocumentDropOrPasteEditKind Kind} of the edit.
|
|
243
|
+
*/
|
|
244
|
+
kind: DocumentDropOrPasteEditKind;
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Controls the ordering or multiple edits. If this provider yield to edits, it will be shown lower in the list.
|
|
248
|
+
*/
|
|
249
|
+
yieldTo?: readonly DocumentDropOrPasteEditKind[];
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export interface DocumentDropEditProvider<T extends DocumentDropEdit = DocumentDropEdit> {
|
|
253
|
+
// Overload that allows returning multiple edits
|
|
254
|
+
// Will be merged in on finalization
|
|
255
|
+
provideDocumentDropEdits(document: TextDocument, position: Position, dataTransfer: DataTransfer, token: CancellationToken):
|
|
256
|
+
ProviderResult<DocumentDropEdit | DocumentDropEdit[]>;
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Optional method which fills in the {@linkcode DocumentDropEdit.additionalEdit} before the edit is applied.
|
|
260
|
+
*
|
|
261
|
+
* This is called once per edit and should be used if generating the complete edit may take a long time.
|
|
262
|
+
* Resolve can only be used to change {@link DocumentDropEdit.additionalEdit}.
|
|
263
|
+
*
|
|
264
|
+
* @param pasteEdit The {@linkcode DocumentDropEdit} to resolve.
|
|
265
|
+
* @param token A cancellation token.
|
|
266
|
+
*
|
|
267
|
+
* @returns The resolved edit or a thenable that resolves to such. It is OK to return the given
|
|
268
|
+
* `edit`. If no result is returned, the given `edit` is used.
|
|
269
|
+
*/
|
|
270
|
+
resolveDocumentDropEdit?(edit: T, token: CancellationToken): ProviderResult<T>;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Provides additional metadata about how a {@linkcode DocumentDropEditProvider} works.
|
|
275
|
+
*/
|
|
276
|
+
export interface DocumentDropEditProviderMetadata {
|
|
277
|
+
/**
|
|
278
|
+
* List of {@link DocumentDropOrPasteEditKind kinds} that the provider may return in {@linkcode DocumentDropEditProvider.provideDocumentDropEdits provideDocumentDropEdits}.
|
|
279
|
+
*
|
|
280
|
+
* This is used to filter out providers when a specific {@link DocumentDropOrPasteEditKind kind} of edit is requested.
|
|
281
|
+
*/
|
|
282
|
+
readonly providedDropEditKinds?: readonly DocumentDropOrPasteEditKind[];
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* List of {@link DataTransfer} mime types that the provider can handle.
|
|
286
|
+
*
|
|
287
|
+
* This can either be an exact mime type such as `image/png`, or a wildcard pattern such as `image/*`.
|
|
288
|
+
*
|
|
289
|
+
* Use `text/uri-list` for resources dropped from the explorer or other tree views in the workbench.
|
|
290
|
+
*
|
|
291
|
+
* Use `files` to indicate that the provider should be invoked if any {@link DataTransferFile files} are present in the {@link DataTransfer}.
|
|
292
|
+
* Note that {@link DataTransferFile} entries are only created when dropping content from outside the editor, such as
|
|
293
|
+
* from the operating system.
|
|
294
|
+
*/
|
|
295
|
+
readonly dropMimeTypes: readonly string[];
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
namespace languages {
|
|
299
|
+
/**
|
|
300
|
+
* Registers a new {@linkcode DocumentPasteEditProvider}.
|
|
301
|
+
*
|
|
302
|
+
* @param selector A selector that defines the documents this provider applies to.
|
|
303
|
+
* @param provider A paste editor provider.
|
|
304
|
+
* @param metadata Additional metadata about the provider.
|
|
305
|
+
*
|
|
306
|
+
* @returns A {@link Disposable} that unregisters this provider when disposed of.
|
|
307
|
+
* @stubbed
|
|
308
|
+
*/
|
|
309
|
+
export function registerDocumentPasteEditProvider(selector: DocumentSelector, provider: DocumentPasteEditProvider, metadata: DocumentPasteProviderMetadata): Disposable;
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Overload which adds extra metadata. Will be removed on finalization.
|
|
313
|
+
*/
|
|
314
|
+
export function registerDocumentDropEditProvider(selector: DocumentSelector, provider: DocumentDropEditProvider, metadata?: DocumentDropEditProviderMetadata): Disposable;
|
|
315
|
+
}
|
|
316
|
+
}
|