@theia/plugin 1.59.0-next.72 → 1.60.0-next.43
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 +3 -3
- package/src/theia.d.ts +373 -27
- package/src/theia.proposed.documentPaste.d.ts +0 -330
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.60.0-next.43+2a13720d2",
|
|
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.
|
|
30
|
+
"@theia/ext-scripts": "1.59.0"
|
|
31
31
|
},
|
|
32
32
|
"nyc": {
|
|
33
33
|
"extends": "../../configs/nyc.json"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "2a13720d2d41d8ae6ee4e34cd2dee1c656a18018"
|
|
36
36
|
}
|
package/src/theia.d.ts
CHANGED
|
@@ -27,7 +27,6 @@ import './theia.proposed.createFileSystemWatcher';
|
|
|
27
27
|
import './theia.proposed.customEditorMove';
|
|
28
28
|
import './theia.proposed.debugVisualization';
|
|
29
29
|
import './theia.proposed.diffCommand';
|
|
30
|
-
import './theia.proposed.documentPaste';
|
|
31
30
|
import './theia.proposed.editSessionIdentityProvider';
|
|
32
31
|
import './theia.proposed.extensionsAny';
|
|
33
32
|
import './theia.proposed.externalUriOpener';
|
|
@@ -358,19 +357,21 @@ export module '@theia/plugin' {
|
|
|
358
357
|
export class Selection extends Range {
|
|
359
358
|
|
|
360
359
|
/**
|
|
361
|
-
*
|
|
360
|
+
* The position at which the selection starts.
|
|
361
|
+
* This position might be before or after {@link Selection.active active}.
|
|
362
362
|
*/
|
|
363
|
-
anchor: Position;
|
|
363
|
+
readonly anchor: Position;
|
|
364
364
|
|
|
365
365
|
/**
|
|
366
|
-
*
|
|
366
|
+
* The position of the cursor.
|
|
367
|
+
* This position might be before or after {@link Selection.anchor anchor}.
|
|
367
368
|
*/
|
|
368
|
-
active: Position;
|
|
369
|
+
readonly active: Position;
|
|
369
370
|
|
|
370
371
|
/**
|
|
371
|
-
* A selection is reversed if
|
|
372
|
+
* A selection is reversed if its {@link Selection.anchor anchor} is the {@link Selection.end end} position.
|
|
372
373
|
*/
|
|
373
|
-
isReversed: boolean;
|
|
374
|
+
readonly isReversed: boolean;
|
|
374
375
|
|
|
375
376
|
/**
|
|
376
377
|
* Create a selection from two positions.
|
|
@@ -3436,10 +3437,17 @@ export module '@theia/plugin' {
|
|
|
3436
3437
|
/**
|
|
3437
3438
|
* The exit code reported by the shell.
|
|
3438
3439
|
*
|
|
3439
|
-
*
|
|
3440
|
-
*
|
|
3441
|
-
*
|
|
3442
|
-
*
|
|
3440
|
+
* When this is `undefined` it can mean several things:
|
|
3441
|
+
*
|
|
3442
|
+
* - The shell either did not report an exit code (ie. the shell integration script is
|
|
3443
|
+
* misbehaving)
|
|
3444
|
+
* - The shell reported a command started before the command finished (eg. a sub-shell was
|
|
3445
|
+
* opened).
|
|
3446
|
+
* - The user canceled the command via ctrl+c.
|
|
3447
|
+
* - The user pressed enter when there was no input.
|
|
3448
|
+
*
|
|
3449
|
+
* Generally this should not happen. Depending on the use case, it may be best to treat this
|
|
3450
|
+
* as a failure.
|
|
3443
3451
|
*
|
|
3444
3452
|
* @example
|
|
3445
3453
|
* const execution = shellIntegration.executeCommand({
|
|
@@ -3449,15 +3457,14 @@ export module '@theia/plugin' {
|
|
|
3449
3457
|
* window.onDidEndTerminalShellExecution(event => {
|
|
3450
3458
|
* if (event.execution === execution) {
|
|
3451
3459
|
* if (event.exitCode === undefined) {
|
|
3452
|
-
*
|
|
3460
|
+
* console.log('Command finished but exit code is unknown');
|
|
3453
3461
|
* } else if (event.exitCode === 0) {
|
|
3454
|
-
*
|
|
3462
|
+
* console.log('Command succeeded');
|
|
3455
3463
|
* } else {
|
|
3456
|
-
*
|
|
3464
|
+
* console.log('Command failed');
|
|
3457
3465
|
* }
|
|
3458
3466
|
* }
|
|
3459
3467
|
* });
|
|
3460
|
-
* @stubbed
|
|
3461
3468
|
*/
|
|
3462
3469
|
readonly exitCode: number | undefined;
|
|
3463
3470
|
}
|
|
@@ -11375,12 +11382,44 @@ export module '@theia/plugin' {
|
|
|
11375
11382
|
/**
|
|
11376
11383
|
* Registers a new {@link DocumentDropEditProvider}.
|
|
11377
11384
|
*
|
|
11385
|
+
* Multiple drop providers can be registered for a language. When dropping content into an editor, all
|
|
11386
|
+
* registered providers for the editor's language will be invoked based on the mimetypes they handle
|
|
11387
|
+
* as specified by their {@linkcode DocumentDropEditProviderMetadata}.
|
|
11388
|
+
*
|
|
11389
|
+
* Each provider can return one or more {@linkcode DocumentDropEdit DocumentDropEdits}. The edits are sorted
|
|
11390
|
+
* using the {@linkcode DocumentDropEdit.yieldTo} property. By default the first edit will be applied. If there
|
|
11391
|
+
* are any additional edits, these will be shown to the user as selectable drop options in the drop widget.
|
|
11392
|
+
*
|
|
11378
11393
|
* @param selector A selector that defines the documents this provider applies to.
|
|
11379
11394
|
* @param provider A drop provider.
|
|
11395
|
+
* @param metadata Additional metadata about the provider.
|
|
11396
|
+
*
|
|
11397
|
+
* @returns A {@linkcode Disposable} that unregisters this provider when disposed of.
|
|
11398
|
+
*/
|
|
11399
|
+
export function registerDocumentDropEditProvider(selector: DocumentSelector, provider: DocumentDropEditProvider, metadata?: DocumentDropEditProviderMetadata): Disposable;
|
|
11400
|
+
|
|
11401
|
+
/**
|
|
11402
|
+
* Registers a new {@linkcode DocumentPasteEditProvider}.
|
|
11403
|
+
*
|
|
11404
|
+
* Multiple providers can be registered for a language. All registered providers for a language will be invoked
|
|
11405
|
+
* for copy and paste operations based on their handled mimetypes as specified by the {@linkcode DocumentPasteProviderMetadata}.
|
|
11406
|
+
*
|
|
11407
|
+
* For {@link DocumentPasteEditProvider.prepareDocumentPaste copy operations}, changes to the {@linkcode DataTransfer}
|
|
11408
|
+
* made by each provider will be merged into a single {@linkcode DataTransfer} that is used to populate the clipboard.
|
|
11409
|
+
*
|
|
11410
|
+
* For {@link DocumentPasteEditProvider.providerDocumentPasteEdits paste operations}, each provider will be invoked
|
|
11411
|
+
* and can return one or more {@linkcode DocumentPasteEdit DocumentPasteEdits}. The edits are sorted using
|
|
11412
|
+
* the {@linkcode DocumentPasteEdit.yieldTo} property. By default the first edit will be applied
|
|
11413
|
+
* and the rest of the edits will be shown to the user as selectable paste options in the paste widget.
|
|
11380
11414
|
*
|
|
11381
|
-
* @
|
|
11415
|
+
* @param selector A selector that defines the documents this provider applies to.
|
|
11416
|
+
* @param provider A paste editor provider.
|
|
11417
|
+
* @param metadata Additional metadata about the provider.
|
|
11418
|
+
*
|
|
11419
|
+
* @returns A {@linkcode Disposable} that unregisters this provider when disposed of.
|
|
11420
|
+
* @stubbed
|
|
11382
11421
|
*/
|
|
11383
|
-
export function
|
|
11422
|
+
export function registerDocumentPasteEditProvider(selector: DocumentSelector, provider: DocumentPasteEditProvider, metadata: DocumentPasteProviderMetadata): Disposable;
|
|
11384
11423
|
|
|
11385
11424
|
/**
|
|
11386
11425
|
* Register a declaration provider.
|
|
@@ -13186,7 +13225,7 @@ export module '@theia/plugin' {
|
|
|
13186
13225
|
/**
|
|
13187
13226
|
* The shell command line. Is `undefined` if created with a command and arguments.
|
|
13188
13227
|
*/
|
|
13189
|
-
commandLine
|
|
13228
|
+
commandLine: string | undefined;
|
|
13190
13229
|
|
|
13191
13230
|
/**
|
|
13192
13231
|
* The shell options used when the command line is executed in a shell.
|
|
@@ -13197,12 +13236,12 @@ export module '@theia/plugin' {
|
|
|
13197
13236
|
/**
|
|
13198
13237
|
* The shell command. Is `undefined` if created with a full command line.
|
|
13199
13238
|
*/
|
|
13200
|
-
command
|
|
13239
|
+
command: string | ShellQuotedString | undefined;
|
|
13201
13240
|
|
|
13202
13241
|
/**
|
|
13203
13242
|
* The shell args. Is `undefined` if created with a full command line.
|
|
13204
13243
|
*/
|
|
13205
|
-
args
|
|
13244
|
+
args: Array<string | ShellQuotedString> | undefined;
|
|
13206
13245
|
}
|
|
13207
13246
|
|
|
13208
13247
|
export interface ProcessExecutionOptions {
|
|
@@ -13744,9 +13783,10 @@ export module '@theia/plugin' {
|
|
|
13744
13783
|
|
|
13745
13784
|
/**
|
|
13746
13785
|
* The range the comment thread is located within the document. The thread icon will be shown
|
|
13747
|
-
* at the
|
|
13786
|
+
* at the last line of the range. When set to undefined, the comment will be associated with the
|
|
13787
|
+
* file, and not a specific range.
|
|
13748
13788
|
*/
|
|
13749
|
-
range: Range;
|
|
13789
|
+
range: Range | undefined;
|
|
13750
13790
|
|
|
13751
13791
|
/**
|
|
13752
13792
|
* The ordered comments of the thread.
|
|
@@ -13921,6 +13961,21 @@ export module '@theia/plugin' {
|
|
|
13921
13961
|
text: string;
|
|
13922
13962
|
}
|
|
13923
13963
|
|
|
13964
|
+
/**
|
|
13965
|
+
* The ranges a CommentingRangeProvider enables commenting on.
|
|
13966
|
+
*/
|
|
13967
|
+
export interface CommentingRanges {
|
|
13968
|
+
/**
|
|
13969
|
+
* Enables comments to be added to a file without a specific range.
|
|
13970
|
+
*/
|
|
13971
|
+
enableFileComments: boolean;
|
|
13972
|
+
|
|
13973
|
+
/**
|
|
13974
|
+
* The ranges which allow new comment threads creation.
|
|
13975
|
+
*/
|
|
13976
|
+
ranges?: Range[];
|
|
13977
|
+
}
|
|
13978
|
+
|
|
13924
13979
|
/**
|
|
13925
13980
|
* Commenting range provider for a {@link CommentController comment controller}.
|
|
13926
13981
|
*/
|
|
@@ -13928,7 +13983,7 @@ export module '@theia/plugin' {
|
|
|
13928
13983
|
/**
|
|
13929
13984
|
* Provide a list of ranges which allow new comment threads creation or null for a given document
|
|
13930
13985
|
*/
|
|
13931
|
-
provideCommentingRanges(document: TextDocument, token: CancellationToken): ProviderResult<Range[]>;
|
|
13986
|
+
provideCommentingRanges(document: TextDocument, token: CancellationToken): ProviderResult<Range[] | CommentingRanges>;
|
|
13932
13987
|
}
|
|
13933
13988
|
|
|
13934
13989
|
/**
|
|
@@ -14343,10 +14398,88 @@ export module '@theia/plugin' {
|
|
|
14343
14398
|
provideLinkedEditingRanges(document: TextDocument, position: Position, token: CancellationToken): ProviderResult<LinkedEditingRanges>;
|
|
14344
14399
|
}
|
|
14345
14400
|
|
|
14401
|
+
/**
|
|
14402
|
+
* Identifies a {@linkcode DocumentDropEdit} or {@linkcode DocumentPasteEdit}
|
|
14403
|
+
*/
|
|
14404
|
+
export class DocumentDropOrPasteEditKind {
|
|
14405
|
+
static readonly Empty: DocumentDropOrPasteEditKind;
|
|
14406
|
+
|
|
14407
|
+
/**
|
|
14408
|
+
* The root kind for basic text edits.
|
|
14409
|
+
*
|
|
14410
|
+
* This kind should be used for edits that insert basic text into the document. A good example of this is
|
|
14411
|
+
* an edit that pastes the clipboard text while also updating imports in the file based on the pasted text.
|
|
14412
|
+
* For this we could use a kind such as `text.updateImports.someLanguageId`.
|
|
14413
|
+
*
|
|
14414
|
+
* Even though most drop/paste edits ultimately insert text, you should not use {@linkcode Text} as the base kind
|
|
14415
|
+
* for every edit as this is redundant. Instead a more specific kind that describes the type of content being
|
|
14416
|
+
* inserted should be used instead. For example, if the edit adds a Markdown link, use `markdown.link` since even
|
|
14417
|
+
* though the content being inserted is text, it's more important to know that the edit inserts Markdown syntax.
|
|
14418
|
+
*/
|
|
14419
|
+
static readonly Text: DocumentDropOrPasteEditKind;
|
|
14420
|
+
|
|
14421
|
+
/**
|
|
14422
|
+
* Root kind for edits that update imports in a document in addition to inserting text.
|
|
14423
|
+
*/
|
|
14424
|
+
static readonly TextUpdateImports: DocumentDropOrPasteEditKind;
|
|
14425
|
+
|
|
14426
|
+
/**
|
|
14427
|
+
* Use {@linkcode DocumentDropOrPasteEditKind.Empty} instead.
|
|
14428
|
+
*/
|
|
14429
|
+
private constructor(value: string);
|
|
14430
|
+
|
|
14431
|
+
/**
|
|
14432
|
+
* The raw string value of the kind.
|
|
14433
|
+
*/
|
|
14434
|
+
readonly value: string;
|
|
14435
|
+
|
|
14436
|
+
/**
|
|
14437
|
+
* Create a new kind by appending additional scopes to the current kind.
|
|
14438
|
+
*
|
|
14439
|
+
* Does not modify the current kind.
|
|
14440
|
+
*/
|
|
14441
|
+
append(...parts: string[]): DocumentDropOrPasteEditKind;
|
|
14442
|
+
|
|
14443
|
+
/**
|
|
14444
|
+
* Checks if this kind intersects `other`.
|
|
14445
|
+
*
|
|
14446
|
+
* The kind `"text.plain"` for example intersects `text`, `"text.plain"` and `"text.plain.list"`,
|
|
14447
|
+
* but not `"unicorn"`, or `"textUnicorn.plain"`.
|
|
14448
|
+
*
|
|
14449
|
+
* @param other Kind to check.
|
|
14450
|
+
*/
|
|
14451
|
+
intersects(other: DocumentDropOrPasteEditKind): boolean;
|
|
14452
|
+
|
|
14453
|
+
/**
|
|
14454
|
+
* Checks if `other` is a sub-kind of this `DocumentDropOrPasteEditKind`.
|
|
14455
|
+
*
|
|
14456
|
+
* The kind `"text.plain"` for example contains `"text.plain"` and `"text.plain.list"`,
|
|
14457
|
+
* but not `"text"` or `"unicorn.text.plain"`.
|
|
14458
|
+
*
|
|
14459
|
+
* @param other Kind to check.
|
|
14460
|
+
*/
|
|
14461
|
+
contains(other: DocumentDropOrPasteEditKind): boolean;
|
|
14462
|
+
}
|
|
14463
|
+
|
|
14346
14464
|
/**
|
|
14347
14465
|
* An edit operation applied {@link DocumentDropEditProvider on drop}.
|
|
14348
14466
|
*/
|
|
14349
14467
|
export class DocumentDropEdit {
|
|
14468
|
+
/**
|
|
14469
|
+
* Human readable label that describes the edit.
|
|
14470
|
+
*/
|
|
14471
|
+
title?: string;
|
|
14472
|
+
|
|
14473
|
+
/**
|
|
14474
|
+
* {@link DocumentDropOrPasteEditKind Kind} of the edit.
|
|
14475
|
+
*/
|
|
14476
|
+
kind?: DocumentDropOrPasteEditKind;
|
|
14477
|
+
|
|
14478
|
+
/**
|
|
14479
|
+
* Controls the ordering or multiple edits. If this provider yield to edits, it will be shown lower in the list.
|
|
14480
|
+
*/
|
|
14481
|
+
yieldTo?: readonly DocumentDropOrPasteEditKind[];
|
|
14482
|
+
|
|
14350
14483
|
/**
|
|
14351
14484
|
* The text or snippet to insert at the drop location.
|
|
14352
14485
|
*/
|
|
@@ -14359,8 +14492,10 @@ export module '@theia/plugin' {
|
|
|
14359
14492
|
|
|
14360
14493
|
/**
|
|
14361
14494
|
* @param insertText The text or snippet to insert at the drop location.
|
|
14495
|
+
* @param title Human readable label that describes the edit.
|
|
14496
|
+
* @param kind {@link DocumentDropOrPasteEditKind Kind} of the edit.
|
|
14362
14497
|
*/
|
|
14363
|
-
constructor(insertText: string | SnippetString);
|
|
14498
|
+
constructor(insertText: string | SnippetString, title?: string, kind?: DocumentDropOrPasteEditKind);
|
|
14364
14499
|
}
|
|
14365
14500
|
|
|
14366
14501
|
/**
|
|
@@ -14370,7 +14505,7 @@ export module '@theia/plugin' {
|
|
|
14370
14505
|
* and dropping files, users can hold down `shift` to drop the file into the editor instead of opening it.
|
|
14371
14506
|
* Requires `editor.dropIntoEditor.enabled` to be on.
|
|
14372
14507
|
*/
|
|
14373
|
-
export interface DocumentDropEditProvider {
|
|
14508
|
+
export interface DocumentDropEditProvider<T extends DocumentDropEdit = DocumentDropEdit> {
|
|
14374
14509
|
/**
|
|
14375
14510
|
* Provide edits which inserts the content being dragged and dropped into the document.
|
|
14376
14511
|
*
|
|
@@ -14379,12 +14514,223 @@ export module '@theia/plugin' {
|
|
|
14379
14514
|
* @param dataTransfer A {@link DataTransfer} object that holds data about what is being dragged and dropped.
|
|
14380
14515
|
* @param token A cancellation token.
|
|
14381
14516
|
*
|
|
14382
|
-
* @
|
|
14517
|
+
* @returns A {@link DocumentDropEdit} or a thenable that resolves to such. The lack of a result can be
|
|
14383
14518
|
* signaled by returning `undefined` or `null`.
|
|
14384
14519
|
*/
|
|
14385
|
-
provideDocumentDropEdits(document: TextDocument, position: Position, dataTransfer: DataTransfer, token: CancellationToken): ProviderResult<
|
|
14520
|
+
provideDocumentDropEdits(document: TextDocument, position: Position, dataTransfer: DataTransfer, token: CancellationToken): ProviderResult<T | T[]>;
|
|
14521
|
+
|
|
14522
|
+
/**
|
|
14523
|
+
* Optional method which fills in the {@linkcode DocumentDropEdit.additionalEdit} before the edit is applied.
|
|
14524
|
+
*
|
|
14525
|
+
* This is called once per edit and should be used if generating the complete edit may take a long time.
|
|
14526
|
+
* Resolve can only be used to change {@link DocumentDropEdit.additionalEdit}.
|
|
14527
|
+
*
|
|
14528
|
+
* @param edit The {@linkcode DocumentDropEdit} to resolve.
|
|
14529
|
+
* @param token A cancellation token.
|
|
14530
|
+
*
|
|
14531
|
+
* @returns The resolved edit or a thenable that resolves to such. It is OK to return the given
|
|
14532
|
+
* `edit`. If no result is returned, the given `edit` is used.
|
|
14533
|
+
* @stubbed
|
|
14534
|
+
*/
|
|
14535
|
+
resolveDocumentDropEdit?(edit: T, token: CancellationToken): ProviderResult<T>;
|
|
14536
|
+
}
|
|
14537
|
+
|
|
14538
|
+
/**
|
|
14539
|
+
* Provides additional metadata about how a {@linkcode DocumentDropEditProvider} works.
|
|
14540
|
+
*/
|
|
14541
|
+
export interface DocumentDropEditProviderMetadata {
|
|
14542
|
+
/**
|
|
14543
|
+
* List of {@link DocumentDropOrPasteEditKind kinds} that the provider may return in {@linkcode DocumentDropEditProvider.provideDocumentDropEdits provideDocumentDropEdits}.
|
|
14544
|
+
*
|
|
14545
|
+
* This is used to filter out providers when a specific {@link DocumentDropOrPasteEditKind kind} of edit is requested.
|
|
14546
|
+
*/
|
|
14547
|
+
readonly providedDropEditKinds?: readonly DocumentDropOrPasteEditKind[];
|
|
14548
|
+
|
|
14549
|
+
/**
|
|
14550
|
+
* List of {@link DataTransfer} mime types that the provider can handle.
|
|
14551
|
+
*
|
|
14552
|
+
* This can either be an exact mime type such as `image/png`, or a wildcard pattern such as `image/*`.
|
|
14553
|
+
*
|
|
14554
|
+
* Use `text/uri-list` for resources dropped from the explorer or other tree views in the workbench.
|
|
14555
|
+
*
|
|
14556
|
+
* Use `files` to indicate that the provider should be invoked if any {@link DataTransferFile files} are present in the {@link DataTransfer}.
|
|
14557
|
+
* Note that {@link DataTransferFile} entries are only created when dropping content from outside the editor, such as
|
|
14558
|
+
* from the operating system.
|
|
14559
|
+
*/
|
|
14560
|
+
readonly dropMimeTypes: readonly string[];
|
|
14386
14561
|
}
|
|
14387
14562
|
|
|
14563
|
+
/**
|
|
14564
|
+
* The reason why paste edits were requested.
|
|
14565
|
+
*/
|
|
14566
|
+
export enum DocumentPasteTriggerKind {
|
|
14567
|
+
/**
|
|
14568
|
+
* Pasting was requested as part of a normal paste operation.
|
|
14569
|
+
*/
|
|
14570
|
+
Automatic = 0,
|
|
14571
|
+
|
|
14572
|
+
/**
|
|
14573
|
+
* Pasting was requested by the user with the `paste as` command.
|
|
14574
|
+
*/
|
|
14575
|
+
PasteAs = 1,
|
|
14576
|
+
}
|
|
14577
|
+
|
|
14578
|
+
/**
|
|
14579
|
+
* Additional information about the paste operation.
|
|
14580
|
+
*/
|
|
14581
|
+
export interface DocumentPasteEditContext {
|
|
14582
|
+
|
|
14583
|
+
/**
|
|
14584
|
+
* Requested kind of paste edits to return.
|
|
14585
|
+
*
|
|
14586
|
+
* When a explicit kind if requested by {@linkcode DocumentPasteTriggerKind.PasteAs PasteAs}, providers are
|
|
14587
|
+
* encourage to be more flexible when generating an edit of the requested kind.
|
|
14588
|
+
*/
|
|
14589
|
+
readonly only: DocumentDropOrPasteEditKind | undefined;
|
|
14590
|
+
|
|
14591
|
+
/**
|
|
14592
|
+
* The reason why paste edits were requested.
|
|
14593
|
+
*/
|
|
14594
|
+
readonly triggerKind: DocumentPasteTriggerKind;
|
|
14595
|
+
}
|
|
14596
|
+
|
|
14597
|
+
/**
|
|
14598
|
+
* Provider invoked when the user copies or pastes in a {@linkcode TextDocument}.
|
|
14599
|
+
*/
|
|
14600
|
+
export interface DocumentPasteEditProvider<T extends DocumentPasteEdit = DocumentPasteEdit> {
|
|
14601
|
+
|
|
14602
|
+
/**
|
|
14603
|
+
* Optional method invoked after the user copies from a {@link TextEditor text editor}.
|
|
14604
|
+
*
|
|
14605
|
+
* This allows the provider to attach metadata about the copied text to the {@link DataTransfer}. This data
|
|
14606
|
+
* transfer is then passed back to providers in {@linkcode provideDocumentPasteEdits}.
|
|
14607
|
+
*
|
|
14608
|
+
* Note that currently any changes to the {@linkcode DataTransfer} are isolated to the current editor window.
|
|
14609
|
+
* This means that any added metadata cannot be seen by other editor windows or by other applications.
|
|
14610
|
+
*
|
|
14611
|
+
* @param document Text document where the copy took place.
|
|
14612
|
+
* @param ranges Ranges being copied in {@linkcode document}.
|
|
14613
|
+
* @param dataTransfer The data transfer associated with the copy. You can store additional values on this for
|
|
14614
|
+
* later use in {@linkcode provideDocumentPasteEdits}. This object is only valid for the duration of this method.
|
|
14615
|
+
* @param token A cancellation token.
|
|
14616
|
+
*
|
|
14617
|
+
* @return Optional thenable that resolves when all changes to the `dataTransfer` are complete.
|
|
14618
|
+
*/
|
|
14619
|
+
prepareDocumentPaste?(document: TextDocument, ranges: readonly Range[], dataTransfer: DataTransfer, token: CancellationToken): void | Thenable<void>;
|
|
14620
|
+
|
|
14621
|
+
/**
|
|
14622
|
+
* Invoked before the user pastes into a {@link TextEditor text editor}.
|
|
14623
|
+
*
|
|
14624
|
+
* Returned edits can replace the standard pasting behavior.
|
|
14625
|
+
*
|
|
14626
|
+
* @param document Document being pasted into
|
|
14627
|
+
* @param ranges Range in the {@linkcode document} to paste into.
|
|
14628
|
+
* @param dataTransfer The {@link DataTransfer data transfer} associated with the paste. This object is only
|
|
14629
|
+
* valid for the duration of the paste operation.
|
|
14630
|
+
* @param context Additional context for the paste.
|
|
14631
|
+
* @param token A cancellation token.
|
|
14632
|
+
*
|
|
14633
|
+
* @return Set of potential {@link DocumentPasteEdit edits} that can apply the paste. Only a single returned
|
|
14634
|
+
* {@linkcode DocumentPasteEdit} is applied at a time. If multiple edits are returned from all providers, then
|
|
14635
|
+
* the first is automatically applied and a widget is shown that lets the user switch to the other edits.
|
|
14636
|
+
*/
|
|
14637
|
+
provideDocumentPasteEdits?(document: TextDocument, ranges: readonly Range[], dataTransfer: DataTransfer, context: DocumentPasteEditContext, token: CancellationToken): ProviderResult<T[]>;
|
|
14638
|
+
|
|
14639
|
+
/**
|
|
14640
|
+
* Optional method which fills in the {@linkcode DocumentPasteEdit.additionalEdit} before the edit is applied.
|
|
14641
|
+
*
|
|
14642
|
+
* This is called once per edit and should be used if generating the complete edit may take a long time.
|
|
14643
|
+
* Resolve can only be used to change {@linkcode DocumentPasteEdit.insertText} or {@linkcode DocumentPasteEdit.additionalEdit}.
|
|
14644
|
+
*
|
|
14645
|
+
* @param pasteEdit The {@linkcode DocumentPasteEdit} to resolve.
|
|
14646
|
+
* @param token A cancellation token.
|
|
14647
|
+
*
|
|
14648
|
+
* @returns The resolved paste edit or a thenable that resolves to such. It is OK to return the given
|
|
14649
|
+
* `pasteEdit`. If no result is returned, the given `pasteEdit` is used.
|
|
14650
|
+
*/
|
|
14651
|
+
resolveDocumentPasteEdit?(pasteEdit: T, token: CancellationToken): ProviderResult<T>;
|
|
14652
|
+
}
|
|
14653
|
+
|
|
14654
|
+
/**
|
|
14655
|
+
* An edit the applies a paste operation.
|
|
14656
|
+
*/
|
|
14657
|
+
export class DocumentPasteEdit {
|
|
14658
|
+
|
|
14659
|
+
/**
|
|
14660
|
+
* Human readable label that describes the edit.
|
|
14661
|
+
*/
|
|
14662
|
+
title: string;
|
|
14663
|
+
|
|
14664
|
+
/**
|
|
14665
|
+
* {@link DocumentDropOrPasteEditKind Kind} of the edit.
|
|
14666
|
+
*/
|
|
14667
|
+
kind: DocumentDropOrPasteEditKind;
|
|
14668
|
+
|
|
14669
|
+
/**
|
|
14670
|
+
* The text or snippet to insert at the pasted locations.
|
|
14671
|
+
*
|
|
14672
|
+
* If your edit requires more advanced insertion logic, set this to an empty string and provide an {@link DocumentPasteEdit.additionalEdit additional edit} instead.
|
|
14673
|
+
*/
|
|
14674
|
+
insertText: string | SnippetString;
|
|
14675
|
+
|
|
14676
|
+
/**
|
|
14677
|
+
* An optional additional edit to apply on paste.
|
|
14678
|
+
*/
|
|
14679
|
+
additionalEdit?: WorkspaceEdit;
|
|
14680
|
+
|
|
14681
|
+
/**
|
|
14682
|
+
* Controls ordering when multiple paste edits can potentially be applied.
|
|
14683
|
+
*
|
|
14684
|
+
* If this edit yields to another, it will be shown lower in the list of possible paste edits shown to the user.
|
|
14685
|
+
*/
|
|
14686
|
+
yieldTo?: readonly DocumentDropOrPasteEditKind[];
|
|
14687
|
+
|
|
14688
|
+
/**
|
|
14689
|
+
* Create a new paste edit.
|
|
14690
|
+
*
|
|
14691
|
+
* @param insertText The text or snippet to insert at the pasted locations.
|
|
14692
|
+
* @param title Human readable label that describes the edit.
|
|
14693
|
+
* @param kind {@link DocumentDropOrPasteEditKind Kind} of the edit.
|
|
14694
|
+
*/
|
|
14695
|
+
constructor(insertText: string | SnippetString, title: string, kind: DocumentDropOrPasteEditKind);
|
|
14696
|
+
}
|
|
14697
|
+
|
|
14698
|
+
/**
|
|
14699
|
+
* Provides additional metadata about how a {@linkcode DocumentPasteEditProvider} works.
|
|
14700
|
+
*/
|
|
14701
|
+
export interface DocumentPasteProviderMetadata {
|
|
14702
|
+
/**
|
|
14703
|
+
* List of {@link DocumentDropOrPasteEditKind kinds} that the provider may return in {@linkcode DocumentPasteEditProvider.provideDocumentPasteEdits provideDocumentPasteEdits}.
|
|
14704
|
+
*
|
|
14705
|
+
* This is used to filter out providers when a specific {@link DocumentDropOrPasteEditKind kind} of edit is requested.
|
|
14706
|
+
*/
|
|
14707
|
+
readonly providedPasteEditKinds: readonly DocumentDropOrPasteEditKind[];
|
|
14708
|
+
|
|
14709
|
+
/**
|
|
14710
|
+
* Mime types that {@linkcode DocumentPasteEditProvider.prepareDocumentPaste prepareDocumentPaste} may add on copy.
|
|
14711
|
+
*/
|
|
14712
|
+
readonly copyMimeTypes?: readonly string[];
|
|
14713
|
+
|
|
14714
|
+
/**
|
|
14715
|
+
* Mime types that {@linkcode DocumentPasteEditProvider.provideDocumentPasteEdits provideDocumentPasteEdits} should be invoked for.
|
|
14716
|
+
*
|
|
14717
|
+
* This can either be an exact mime type such as `image/png`, or a wildcard pattern such as `image/*`.
|
|
14718
|
+
*
|
|
14719
|
+
* Use `text/uri-list` for resources dropped from the explorer or other tree views in the workbench.
|
|
14720
|
+
*
|
|
14721
|
+
* Use `files` to indicate that the provider should be invoked if any {@link DataTransferFile files} are present in the {@linkcode DataTransfer}.
|
|
14722
|
+
* Note that {@linkcode DataTransferFile} entries are only created when pasting content from outside the editor, such as
|
|
14723
|
+
* from the operating system.
|
|
14724
|
+
*/
|
|
14725
|
+
readonly pasteMimeTypes?: readonly string[];
|
|
14726
|
+
}
|
|
14727
|
+
|
|
14728
|
+
/**
|
|
14729
|
+
* A tuple of two characters, like a pair of
|
|
14730
|
+
* opening and closing brackets.
|
|
14731
|
+
*/
|
|
14732
|
+
export type CharacterPair = [string, string];
|
|
14733
|
+
|
|
14388
14734
|
/**
|
|
14389
14735
|
* Represents a session of a currently logged in user.
|
|
14390
14736
|
*/
|
|
@@ -1,330 +0,0 @@
|
|
|
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
|
-
/**
|
|
32
|
-
* The root kind for basic text edits.
|
|
33
|
-
*
|
|
34
|
-
* This kind should be used for edits that insert basic text into the document. A good example of this is
|
|
35
|
-
* an edit that pastes the clipboard text while also updating imports in the file based on the pasted text.
|
|
36
|
-
* For this we could use a kind such as `text.updateImports.someLanguageId`.
|
|
37
|
-
*
|
|
38
|
-
* Even though most drop/paste edits ultimately insert text, you should not use {@linkcode Text} as the base kind
|
|
39
|
-
* for every edit as this is redundant. Instead a more specific kind that describes the type of content being
|
|
40
|
-
* inserted should be used instead For example, if the edit adds a Markdown link, use `markdown.link` since even
|
|
41
|
-
* though the content being inserted is text, it's more important to know that the edit inserts Markdown syntax.
|
|
42
|
-
*/
|
|
43
|
-
static readonly Text: DocumentDropOrPasteEditKind;
|
|
44
|
-
|
|
45
|
-
private constructor(value: string);
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* The raw string value of the kind.
|
|
49
|
-
*/
|
|
50
|
-
readonly value: string;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Create a new kind by appending additional scopes to the current kind.
|
|
54
|
-
*
|
|
55
|
-
* Does not modify the current kind.
|
|
56
|
-
*/
|
|
57
|
-
append(...parts: string[]): DocumentDropOrPasteEditKind;
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Checks if this kind intersects `other`.
|
|
61
|
-
*
|
|
62
|
-
* The kind `"text.plain"` for example intersects `text`, `"text.plain"` and `"text.plain.list"`,
|
|
63
|
-
* but not `"unicorn"`, or `"textUnicorn.plain"`.
|
|
64
|
-
*
|
|
65
|
-
* @param other Kind to check.
|
|
66
|
-
*/
|
|
67
|
-
intersects(other: DocumentDropOrPasteEditKind): boolean;
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Checks if `other` is a sub-kind of this `DocumentDropOrPasteEditKind`.
|
|
71
|
-
*
|
|
72
|
-
* The kind `"text.plain"` for example contains `"text.plain"` and `"text.plain.list"`,
|
|
73
|
-
* but not `"text"` or `"unicorn.text.plain"`.
|
|
74
|
-
*
|
|
75
|
-
* @param other Kind to check.
|
|
76
|
-
*/
|
|
77
|
-
contains(other: DocumentDropOrPasteEditKind): boolean;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* The reason why paste edits were requested.
|
|
82
|
-
*/
|
|
83
|
-
export enum DocumentPasteTriggerKind {
|
|
84
|
-
/**
|
|
85
|
-
* Pasting was requested as part of a normal paste operation.
|
|
86
|
-
*/
|
|
87
|
-
Automatic = 0,
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Pasting was requested by the user with the `paste as` command.
|
|
91
|
-
*/
|
|
92
|
-
PasteAs = 1,
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Additional information about the paste operation.
|
|
97
|
-
*/
|
|
98
|
-
|
|
99
|
-
export interface DocumentPasteEditContext {
|
|
100
|
-
/**
|
|
101
|
-
* Requested kind of paste edits to return.
|
|
102
|
-
*/
|
|
103
|
-
readonly only: DocumentDropOrPasteEditKind | undefined;
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* The reason why paste edits were requested.
|
|
107
|
-
*/
|
|
108
|
-
readonly triggerKind: DocumentPasteTriggerKind;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Provider invoked when the user copies or pastes in a {@linkcode TextDocument}.
|
|
113
|
-
*/
|
|
114
|
-
interface DocumentPasteEditProvider<T extends DocumentPasteEdit = DocumentPasteEdit> {
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Optional method invoked after the user copies from a {@link TextEditor text editor}.
|
|
118
|
-
*
|
|
119
|
-
* This allows the provider to attach metadata about the copied text to the {@link DataTransfer}. This data
|
|
120
|
-
* transfer is then passed back to providers in {@linkcode provideDocumentPasteEdits}.
|
|
121
|
-
*
|
|
122
|
-
* Note that currently any changes to the {@linkcode DataTransfer} are isolated to the current editor window.
|
|
123
|
-
* This means that any added metadata cannot be seen by other editor windows or by other applications.
|
|
124
|
-
*
|
|
125
|
-
* @param document Text document where the copy took place.
|
|
126
|
-
* @param ranges Ranges being copied in {@linkcode document}.
|
|
127
|
-
* @param dataTransfer The data transfer associated with the copy. You can store additional values on this for
|
|
128
|
-
* later use in {@linkcode provideDocumentPasteEdits}. This object is only valid for the duration of this method.
|
|
129
|
-
* @param token A cancellation token.
|
|
130
|
-
*
|
|
131
|
-
* @return Optional thenable that resolves when all changes to the `dataTransfer` are complete.
|
|
132
|
-
*/
|
|
133
|
-
prepareDocumentPaste?(document: TextDocument, ranges: readonly Range[], dataTransfer: DataTransfer, token: CancellationToken): void | Thenable<void>;
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Invoked before the user pastes into a {@link TextEditor text editor}.
|
|
137
|
-
*
|
|
138
|
-
* Returned edits can replace the standard pasting behavior.
|
|
139
|
-
*
|
|
140
|
-
* @param document Document being pasted into
|
|
141
|
-
* @param ranges Range in the {@linkcode document} to paste into.
|
|
142
|
-
* @param dataTransfer The {@link DataTransfer data transfer} associated with the paste. This object is only
|
|
143
|
-
* valid for the duration of the paste operation.
|
|
144
|
-
* @param context Additional context for the paste.
|
|
145
|
-
* @param token A cancellation token.
|
|
146
|
-
*
|
|
147
|
-
* @return Set of potential {@link DocumentPasteEdit edits} that can apply the paste. Only a single returned
|
|
148
|
-
* {@linkcode DocumentPasteEdit} is applied at a time. If multiple edits are returned from all providers, then
|
|
149
|
-
* the first is automatically applied and a widget is shown that lets the user switch to the other edits.
|
|
150
|
-
*/
|
|
151
|
-
provideDocumentPasteEdits?(document: TextDocument, ranges: readonly Range[], dataTransfer: DataTransfer, context: DocumentPasteEditContext, token: CancellationToken):
|
|
152
|
-
ProviderResult<T[]>;
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Optional method which fills in the {@linkcode DocumentPasteEdit.additionalEdit} before the edit is applied.
|
|
156
|
-
*
|
|
157
|
-
* This is called once per edit and should be used if generating the complete edit may take a long time.
|
|
158
|
-
* Resolve can only be used to change {@linkcode DocumentPasteEdit.additionalEdit}.
|
|
159
|
-
*
|
|
160
|
-
* @param pasteEdit The {@linkcode DocumentPasteEdit} to resolve.
|
|
161
|
-
* @param token A cancellation token.
|
|
162
|
-
*
|
|
163
|
-
* @returns The resolved paste edit or a thenable that resolves to such. It is OK to return the given
|
|
164
|
-
* `pasteEdit`. If no result is returned, the given `pasteEdit` is used.
|
|
165
|
-
*/
|
|
166
|
-
resolveDocumentPasteEdit?(pasteEdit: T, token: CancellationToken): ProviderResult<T>;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* An edit the applies a paste operation.
|
|
171
|
-
*/
|
|
172
|
-
class DocumentPasteEdit {
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Human readable label that describes the edit.
|
|
176
|
-
*/
|
|
177
|
-
title: string;
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* {@link DocumentDropOrPasteEditKind Kind} of the edit.
|
|
181
|
-
*/
|
|
182
|
-
kind: DocumentDropOrPasteEditKind;
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* The text or snippet to insert at the pasted locations.
|
|
186
|
-
*
|
|
187
|
-
* If your edit requires more advanced insertion logic, set this to an empty string and provide an {@link DocumentPasteEdit.additionalEdit additional edit} instead.
|
|
188
|
-
*/
|
|
189
|
-
insertText: string | SnippetString;
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* An optional additional edit to apply on paste.
|
|
193
|
-
*/
|
|
194
|
-
additionalEdit?: WorkspaceEdit;
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* Controls ordering when multiple paste edits can potentially be applied.
|
|
198
|
-
*
|
|
199
|
-
* If this edit yields to another, it will be shown lower in the list of possible paste edits shown to the user.
|
|
200
|
-
*/
|
|
201
|
-
yieldTo?: readonly DocumentDropOrPasteEditKind[];
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Create a new paste edit.
|
|
205
|
-
*
|
|
206
|
-
* @param insertText The text or snippet to insert at the pasted locations.
|
|
207
|
-
* @param title Human readable label that describes the edit.
|
|
208
|
-
* @param kind {@link DocumentDropOrPasteEditKind Kind} of the edit.
|
|
209
|
-
*/
|
|
210
|
-
constructor(insertText: string | SnippetString, title: string, kind: DocumentDropOrPasteEditKind);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Provides additional metadata about how a {@linkcode DocumentPasteEditProvider} works.
|
|
215
|
-
*/
|
|
216
|
-
interface DocumentPasteProviderMetadata {
|
|
217
|
-
/**
|
|
218
|
-
* List of {@link DocumentDropOrPasteEditKind kinds} that the provider may return in
|
|
219
|
-
* {@linkcode DocumentPasteEditProvider.provideDocumentPasteEdits provideDocumentPasteEdits}.
|
|
220
|
-
*
|
|
221
|
-
* This is used to filter out providers when a specific {@link DocumentDropOrPasteEditKind kind} of edit is requested.
|
|
222
|
-
*/
|
|
223
|
-
readonly providedPasteEditKinds: readonly DocumentDropOrPasteEditKind[];
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* Mime types that {@linkcode DocumentPasteEditProvider.prepareDocumentPaste prepareDocumentPaste} may add on copy.
|
|
227
|
-
*/
|
|
228
|
-
readonly copyMimeTypes?: readonly string[];
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* Mime types that {@linkcode DocumentPasteEditProvider.provideDocumentPasteEdits provideDocumentPasteEdits} should be invoked for.
|
|
232
|
-
*
|
|
233
|
-
* This can either be an exact mime type such as `image/png`, or a wildcard pattern such as `image/*`.
|
|
234
|
-
*
|
|
235
|
-
* Use `text/uri-list` for resources dropped from the explorer or other tree views in the workbench.
|
|
236
|
-
*
|
|
237
|
-
* Use `files` to indicate that the provider should be invoked if any {@link DataTransferFile files} are present in the {@linkcode DataTransfer}.
|
|
238
|
-
* Note that {@linkcode DataTransferFile} entries are only created when pasting content from outside the editor, such as
|
|
239
|
-
* from the operating system.
|
|
240
|
-
*/
|
|
241
|
-
readonly pasteMimeTypes?: readonly string[];
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* TODO on finalization:
|
|
246
|
-
* - Add ctor(insertText: string | SnippetString, title?: string, kind?: DocumentDropOrPasteEditKind); Can't be done as this is an extension to an existing class
|
|
247
|
-
*/
|
|
248
|
-
|
|
249
|
-
export interface DocumentDropEdit {
|
|
250
|
-
/**
|
|
251
|
-
* Human readable label that describes the edit.
|
|
252
|
-
*/
|
|
253
|
-
title?: string;
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* {@link DocumentDropOrPasteEditKind Kind} of the edit.
|
|
257
|
-
*/
|
|
258
|
-
kind: DocumentDropOrPasteEditKind;
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* Controls the ordering or multiple edits. If this provider yield to edits, it will be shown lower in the list.
|
|
262
|
-
*/
|
|
263
|
-
yieldTo?: readonly DocumentDropOrPasteEditKind[];
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
export interface DocumentDropEditProvider<T extends DocumentDropEdit = DocumentDropEdit> {
|
|
267
|
-
// Overload that allows returning multiple edits
|
|
268
|
-
// Will be merged in on finalization
|
|
269
|
-
provideDocumentDropEdits(document: TextDocument, position: Position, dataTransfer: DataTransfer, token: CancellationToken):
|
|
270
|
-
ProviderResult<DocumentDropEdit | DocumentDropEdit[]>;
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* Optional method which fills in the {@linkcode DocumentDropEdit.additionalEdit} before the edit is applied.
|
|
274
|
-
*
|
|
275
|
-
* This is called once per edit and should be used if generating the complete edit may take a long time.
|
|
276
|
-
* Resolve can only be used to change {@link DocumentDropEdit.additionalEdit}.
|
|
277
|
-
*
|
|
278
|
-
* @param pasteEdit The {@linkcode DocumentDropEdit} to resolve.
|
|
279
|
-
* @param token A cancellation token.
|
|
280
|
-
*
|
|
281
|
-
* @returns The resolved edit or a thenable that resolves to such. It is OK to return the given
|
|
282
|
-
* `edit`. If no result is returned, the given `edit` is used.
|
|
283
|
-
*/
|
|
284
|
-
resolveDocumentDropEdit?(edit: T, token: CancellationToken): ProviderResult<T>;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* Provides additional metadata about how a {@linkcode DocumentDropEditProvider} works.
|
|
289
|
-
*/
|
|
290
|
-
export interface DocumentDropEditProviderMetadata {
|
|
291
|
-
/**
|
|
292
|
-
* List of {@link DocumentDropOrPasteEditKind kinds} that the provider may return in {@linkcode DocumentDropEditProvider.provideDocumentDropEdits provideDocumentDropEdits}.
|
|
293
|
-
*
|
|
294
|
-
* This is used to filter out providers when a specific {@link DocumentDropOrPasteEditKind kind} of edit is requested.
|
|
295
|
-
*/
|
|
296
|
-
readonly providedDropEditKinds?: readonly DocumentDropOrPasteEditKind[];
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* List of {@link DataTransfer} mime types that the provider can handle.
|
|
300
|
-
*
|
|
301
|
-
* This can either be an exact mime type such as `image/png`, or a wildcard pattern such as `image/*`.
|
|
302
|
-
*
|
|
303
|
-
* Use `text/uri-list` for resources dropped from the explorer or other tree views in the workbench.
|
|
304
|
-
*
|
|
305
|
-
* Use `files` to indicate that the provider should be invoked if any {@link DataTransferFile files} are present in the {@link DataTransfer}.
|
|
306
|
-
* Note that {@link DataTransferFile} entries are only created when dropping content from outside the editor, such as
|
|
307
|
-
* from the operating system.
|
|
308
|
-
*/
|
|
309
|
-
readonly dropMimeTypes: readonly string[];
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
namespace languages {
|
|
313
|
-
/**
|
|
314
|
-
* Registers a new {@linkcode DocumentPasteEditProvider}.
|
|
315
|
-
*
|
|
316
|
-
* @param selector A selector that defines the documents this provider applies to.
|
|
317
|
-
* @param provider A paste editor provider.
|
|
318
|
-
* @param metadata Additional metadata about the provider.
|
|
319
|
-
*
|
|
320
|
-
* @returns A {@link Disposable} that unregisters this provider when disposed of.
|
|
321
|
-
* @stubbed
|
|
322
|
-
*/
|
|
323
|
-
export function registerDocumentPasteEditProvider(selector: DocumentSelector, provider: DocumentPasteEditProvider, metadata: DocumentPasteProviderMetadata): Disposable;
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
* Overload which adds extra metadata. Will be removed on finalization.
|
|
327
|
-
*/
|
|
328
|
-
export function registerDocumentDropEditProvider(selector: DocumentSelector, provider: DocumentDropEditProvider, metadata?: DocumentDropEditProviderMetadata): Disposable;
|
|
329
|
-
}
|
|
330
|
-
}
|