@opensumi/sumi 3.4.5 → 3.4.6-next-1730347271.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": "@opensumi/sumi",
3
- "version": "3.4.5",
3
+ "version": "3.4.6-next-1730347271.0",
4
4
  "typings": "index.d.ts",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -12,11 +12,11 @@
12
12
  "build": "tsx ./build.ts"
13
13
  },
14
14
  "dependencies": {
15
- "@opensumi/ide-components": "3.4.5",
15
+ "@opensumi/ide-components": "3.4.6-next-1730347271.0",
16
16
  "vscode-uri": "3.0.2"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@types/react": "^18.2.0"
20
20
  },
21
- "gitHead": "26f3ee057d0a1938de14a8977e12c2972f46c9e4"
21
+ "gitHead": "dc271e0c7c32f35a75bd4e45f28167773c912d13"
22
22
  }
@@ -543,24 +543,35 @@ declare module 'sumi-worker' {
543
543
  Nine = 9,
544
544
  }
545
545
 
546
+ /**
547
+ * Additional data about a workspace edit.
548
+ */
549
+ export interface WorkspaceEditMetadata {
550
+ /**
551
+ * Signal to the editor that this edit is a refactoring.
552
+ */
553
+ isRefactoring?: boolean;
554
+ }
555
+
546
556
  export namespace workspace {
547
557
  /**
548
558
  * Make changes to one or many resources or create, delete, and rename resources as defined by the given
549
- * [workspace edit](#WorkspaceEdit).
559
+ * {@link WorkspaceEdit workspace edit}.
550
560
  *
551
561
  * All changes of a workspace edit are applied in the same order in which they have been added. If
552
562
  * multiple textual inserts are made at the same position, these strings appear in the resulting text
553
- * in the order the 'inserts' were made. Invalid sequences like 'delete file a' -> 'insert text in file a'
554
- * cause failure of the operation.
563
+ * in the order the 'inserts' were made, unless that are interleaved with resource edits. Invalid sequences
564
+ * like 'delete file a' -> 'insert text in file a' cause failure of the operation.
555
565
  *
556
566
  * When applying a workspace edit that consists only of text edits an 'all-or-nothing'-strategy is used.
557
567
  * A workspace edit with resource creations or deletions aborts the operation, e.g. consecutive edits will
558
568
  * not be attempted, when a single edit fails.
559
569
  *
560
570
  * @param edit A workspace edit.
561
- * @return A thenable that resolves when the edit could be applied.
571
+ * @param metadata Optional {@link WorkspaceEditMetadata metadata} for the edit.
572
+ * @returns A thenable that resolves when the edit could be applied.
562
573
  */
563
- export function applyEdit(edit: WorkspaceEdit): Thenable<boolean>;
574
+ export function applyEdit(edit: WorkspaceEdit, metadata?: WorkspaceEditMetadata): Thenable<boolean>;
564
575
  }
565
576
 
566
577
  export namespace window {
@@ -40,6 +40,16 @@ declare module 'vscode' {
40
40
  readonly label: string;
41
41
  }
42
42
 
43
+ /**
44
+ * Optional options to be used when calling {@link authentication.getSession} with the flag `forceNewSession`.
45
+ */
46
+ export interface AuthenticationForceNewSessionOptions {
47
+ /**
48
+ * An optional message that will be displayed to the user when we ask to re-authenticate. Providing additional context
49
+ * as to why you are asking a user to re-authenticate can help increase the odds that they will accept.
50
+ */
51
+ detail?: string;
52
+ }
43
53
 
44
54
  /**
45
55
  * Options to be used when getting an {@link AuthenticationSession} from an {@link AuthenticationProvider}.
@@ -60,14 +70,17 @@ declare module 'vscode' {
60
70
  createIfNone?: boolean;
61
71
 
62
72
  /**
63
- * Whether we should attempt to reauthenticate even if there is already a session available.
64
- *
65
- * If true, a modal dialog will be shown asking the user to sign in again. This is mostly used for scenarios
66
- * where the token needs to be re minted because it has lost some authorization.
67
- *
68
- * Defaults to false.
69
- */
70
- forceNewSession?: boolean | { detail: string };
73
+ * Whether we should attempt to reauthenticate even if there is already a session available.
74
+ *
75
+ * If true, a modal dialog will be shown asking the user to sign in again. This is mostly used for scenarios
76
+ * where the token needs to be re minted because it has lost some authorization.
77
+ *
78
+ * If there are no existing sessions and forceNewSession is true, it will behave identically to
79
+ * {@link AuthenticationGetSessionOptions.createIfNone createIfNone}.
80
+ *
81
+ * This defaults to false.
82
+ */
83
+ forceNewSession?: boolean | AuthenticationForceNewSessionOptions;
71
84
 
72
85
 
73
86
  /**
@@ -202,34 +215,49 @@ declare module 'vscode' {
202
215
  */
203
216
  export namespace authentication {
204
217
  /**
205
- * Get an authentication session matching the desired scopes. Rejects if a provider with providerId is not
206
- * registered, or if the user does not consent to sharing authentication information with
207
- * the extension. If there are multiple sessions with the same scopes, the user will be shown a
208
- * quickpick to select which account they would like to use.
209
- *
210
- * Currently, there are only two authentication providers that are contributed from built in extensions
211
- * to VS Code that implement GitHub and Microsoft authentication: their providerId's are 'github' and 'microsoft'.
212
- * @param providerId The id of the provider to use
213
- * @param scopes A list of scopes representing the permissions requested. These are dependent on the authentication provider
214
- * @param options The {@link GetSessionOptions} to use
215
- * @returns A thenable that resolves to an authentication session
216
- */
217
- export function getSession(providerId: string, scopes: string[], options: AuthenticationGetSessionOptions & { createIfNone: true }): Thenable<AuthenticationSession>;
218
+ * Get an authentication session matching the desired scopes. Rejects if a provider with providerId is not
219
+ * registered, or if the user does not consent to sharing authentication information with
220
+ * the extension. If there are multiple sessions with the same scopes, the user will be shown a
221
+ * quickpick to select which account they would like to use.
222
+ *
223
+ * Currently, there are only two authentication providers that are contributed from built in extensions
224
+ * to the editor that implement GitHub and Microsoft authentication: their providerId's are 'github' and 'microsoft'.
225
+ * @param providerId The id of the provider to use
226
+ * @param scopes A list of scopes representing the permissions requested. These are dependent on the authentication provider
227
+ * @param options The {@link AuthenticationGetSessionOptions} to use
228
+ * @returns A thenable that resolves to an authentication session
229
+ */
230
+ export function getSession(providerId: string, scopes: readonly string[], options: AuthenticationGetSessionOptions & { /** */createIfNone: true }): Thenable<AuthenticationSession>;
218
231
 
219
- /**
220
- * Get an authentication session matching the desired scopes. Rejects if a provider with providerId is not
221
- * registered, or if the user does not consent to sharing authentication information with
222
- * the extension. If there are multiple sessions with the same scopes, the user will be shown a
223
- * quickpick to select which account they would like to use.
224
- *
225
- * Currently, there are only two authentication providers that are contributed from built in extensions
226
- * to VS Code that implement GitHub and Microsoft authentication: their providerId's are 'github' and 'microsoft'.
227
- * @param providerId The id of the provider to use
228
- * @param scopes A list of scopes representing the permissions requested. These are dependent on the authentication provider
229
- * @param options The {@link GetSessionOptions} to use
230
- * @returns A thenable that resolves to an authentication session if available, or undefined if there are no sessions
231
- */
232
- export function getSession(providerId: string, scopes: string[], options?: AuthenticationGetSessionOptions): Thenable<AuthenticationSession | undefined>;
232
+ /**
233
+ * Get an authentication session matching the desired scopes. Rejects if a provider with providerId is not
234
+ * registered, or if the user does not consent to sharing authentication information with
235
+ * the extension. If there are multiple sessions with the same scopes, the user will be shown a
236
+ * quickpick to select which account they would like to use.
237
+ *
238
+ * Currently, there are only two authentication providers that are contributed from built in extensions
239
+ * to the editor that implement GitHub and Microsoft authentication: their providerId's are 'github' and 'microsoft'.
240
+ * @param providerId The id of the provider to use
241
+ * @param scopes A list of scopes representing the permissions requested. These are dependent on the authentication provider
242
+ * @param options The {@link AuthenticationGetSessionOptions} to use
243
+ * @returns A thenable that resolves to an authentication session
244
+ */
245
+ export function getSession(providerId: string, scopes: readonly string[], options: AuthenticationGetSessionOptions & { /** literal-type defines return type */forceNewSession: true | AuthenticationForceNewSessionOptions }): Thenable<AuthenticationSession>;
246
+
247
+ /**
248
+ * Get an authentication session matching the desired scopes. Rejects if a provider with providerId is not
249
+ * registered, or if the user does not consent to sharing authentication information with
250
+ * the extension. If there are multiple sessions with the same scopes, the user will be shown a
251
+ * quickpick to select which account they would like to use.
252
+ *
253
+ * Currently, there are only two authentication providers that are contributed from built in extensions
254
+ * to the editor that implement GitHub and Microsoft authentication: their providerId's are 'github' and 'microsoft'.
255
+ * @param providerId The id of the provider to use
256
+ * @param scopes A list of scopes representing the permissions requested. These are dependent on the authentication provider
257
+ * @param options The {@link AuthenticationGetSessionOptions} to use
258
+ * @returns A thenable that resolves to an authentication session if available, or undefined if there are no sessions
259
+ */
260
+ export function getSession(providerId: string, scopes: readonly string[], options?: AuthenticationGetSessionOptions): Thenable<AuthenticationSession | undefined>;
233
261
 
234
262
  /**
235
263
  * An {@link Event} which fires when the authentication sessions of an authentication provider have
@@ -1480,6 +1480,16 @@ declare module 'vscode' {
1480
1480
  iconPath?: Uri | { light: Uri; dark: Uri } | ThemeIcon;
1481
1481
  }
1482
1482
 
1483
+ /**
1484
+ * Additional data about a workspace edit.
1485
+ */
1486
+ export interface WorkspaceEditMetadata {
1487
+ /**
1488
+ * Signal to the editor that this edit is a refactoring.
1489
+ */
1490
+ isRefactoring?: boolean;
1491
+ }
1492
+
1483
1493
  /**
1484
1494
  * A workspace edit is a collection of textual and files changes for
1485
1495
  * multiple resources and documents.
@@ -4034,6 +4044,28 @@ declare module 'vscode' {
4034
4044
  provideDocumentRangeSemanticTokens(document: TextDocument, range: Range, token: CancellationToken): ProviderResult<SemanticTokens>;
4035
4045
  }
4036
4046
 
4047
+ /**
4048
+ * Provider which handles dropping of resources into a text editor.
4049
+ *
4050
+ * This allows users to drag and drop resources (including resources from external apps) into the editor. While dragging
4051
+ * and dropping files, users can hold down `shift` to drop the file into the editor instead of opening it.
4052
+ * Requires `editor.dropIntoEditor.enabled` to be on.
4053
+ */
4054
+ export interface DocumentDropEditProvider {
4055
+ /**
4056
+ * Provide edits which inserts the content being dragged and dropped into the document.
4057
+ *
4058
+ * @param document The document in which the drop occurred.
4059
+ * @param position The position in the document where the drop occurred.
4060
+ * @param dataTransfer A {@link DataTransfer} object that holds data about what is being dragged and dropped.
4061
+ * @param token A cancellation token.
4062
+ *
4063
+ * @returns A {@link DocumentDropEdit} or a thenable that resolves to such. The lack of a result can be
4064
+ * signaled by returning `undefined` or `null`.
4065
+ */
4066
+ provideDocumentDropEdits(document: TextDocument, position: Position, dataTransfer: DataTransfer, token: CancellationToken): ProviderResult<DocumentDropEdit>;
4067
+ }
4068
+
4037
4069
  //#endregion Semantic Tokens
4038
4070
 
4039
4071
  /**
@@ -483,6 +483,16 @@ declare module 'vscode' {
483
483
  */
484
484
  export function registerDocumentRangeSemanticTokensProvider(selector: DocumentSelector, provider: DocumentRangeSemanticTokensProvider, legend: SemanticTokensLegend): Disposable;
485
485
 
486
+ /**
487
+ * Registers a new {@link DocumentDropEditProvider}.
488
+ *
489
+ * @param selector A selector that defines the documents this provider applies to.
490
+ * @param provider A drop provider.
491
+ *
492
+ * @returns A {@link Disposable} that unregisters this provider when disposed of.
493
+ */
494
+ export function registerDocumentDropEditProvider(selector: DocumentSelector, provider: DocumentDropEditProvider): Disposable;
495
+
486
496
  /**
487
497
  * Register a provider that locates evaluatable expressions in text documents.
488
498
  * VS Code will evaluate the expression in the active debug session and will show the result in the debug hover.
@@ -1584,6 +1594,47 @@ declare module 'vscode' {
1584
1594
  */
1585
1595
  Outdent = 3,
1586
1596
  }
1597
+
1598
+ /**
1599
+ * Enumeration of commonly encountered syntax token types.
1600
+ */
1601
+ export enum SyntaxTokenType {
1602
+ /**
1603
+ * Everything except tokens that are part of comments, string literals and regular expressions.
1604
+ */
1605
+ Other = 0,
1606
+ /**
1607
+ * A comment.
1608
+ */
1609
+ Comment = 1,
1610
+ /**
1611
+ * A string literal.
1612
+ */
1613
+ String = 2,
1614
+ /**
1615
+ * A regular expression.
1616
+ */
1617
+ RegEx = 3
1618
+ }
1619
+
1620
+ /**
1621
+ * Describes pairs of strings where the close string will be automatically inserted when typing the opening string.
1622
+ */
1623
+ export interface AutoClosingPair {
1624
+ /**
1625
+ * The string that will trigger the automatic insertion of the closing string.
1626
+ */
1627
+ open: string;
1628
+ /**
1629
+ * The closing string that will be automatically inserted when typing the opening string.
1630
+ */
1631
+ close: string;
1632
+ /**
1633
+ * A set of tokens where the pair should not be auto closed.
1634
+ */
1635
+ notIn?: SyntaxTokenType[];
1636
+ }
1637
+
1587
1638
  export interface LanguageConfiguration {
1588
1639
  /**
1589
1640
  * The language's comment settings.
@@ -1610,6 +1661,10 @@ declare module 'vscode' {
1610
1661
  * The language's rules to be evaluated when pressing Enter.
1611
1662
  */
1612
1663
  onEnterRules?: OnEnterRule[];
1664
+ /**
1665
+ * The language's auto closing pairs.
1666
+ */
1667
+ autoClosingPairs?: AutoClosingPair[];
1613
1668
 
1614
1669
  /**
1615
1670
  * **Deprecated** Do not use.
@@ -2375,6 +2430,25 @@ declare module 'vscode' {
2375
2430
  * signaled by returning `undefined`, `null`, or an empty array.
2376
2431
  */
2377
2432
  provideDocumentRangeFormattingEdits(document: TextDocument, range: Range, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;
2433
+
2434
+ /**
2435
+ * Provide formatting edits for multiple ranges in a document.
2436
+ *
2437
+ * This function is optional but allows a formatter to perform faster when formatting only modified ranges or when
2438
+ * formatting a large number of selections.
2439
+ *
2440
+ * The given ranges are hints and providers can decide to format a smaller
2441
+ * or larger range. Often this is done by adjusting the start and end
2442
+ * of the range to full syntax nodes.
2443
+ *
2444
+ * @param document The document in which the command was invoked.
2445
+ * @param ranges The ranges which should be formatted.
2446
+ * @param options Options controlling formatting.
2447
+ * @param token A cancellation token.
2448
+ * @returns A set of text edits or a thenable that resolves to such. The lack of a result can be
2449
+ * signaled by returning `undefined`, `null`, or an empty array.
2450
+ */
2451
+ provideDocumentRangesFormattingEdits?(document: TextDocument, ranges: Range[], options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;
2378
2452
  }
2379
2453
 
2380
2454
  /**
@@ -0,0 +1,196 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+
6
+ declare module 'vscode' {
7
+
8
+ // https://github.com/microsoft/vscode/issues/30066/
9
+
10
+ /**
11
+ * The reason why paste edits were requested.
12
+ */
13
+ export enum DocumentPasteTriggerKind {
14
+ /**
15
+ * Pasting was requested as part of a normal paste operation.
16
+ */
17
+ Automatic = 0,
18
+
19
+ /**
20
+ * Pasting was requested by the user with the `paste as` command.
21
+ */
22
+ PasteAs = 1,
23
+ }
24
+
25
+ /**
26
+ * Additional information about the paste operation.
27
+ */
28
+
29
+ export interface DocumentPasteEditContext {
30
+ /**
31
+ * Requested kind of paste edits to return.
32
+ */
33
+ readonly only: DocumentPasteEditKind | undefined;
34
+
35
+ /**
36
+ * The reason why paste edits were requested.
37
+ */
38
+ readonly triggerKind: DocumentPasteTriggerKind;
39
+ }
40
+
41
+ /**
42
+ * Provider invoked when the user copies or pastes in a {@linkcode TextDocument}.
43
+ */
44
+ interface DocumentPasteEditProvider<T extends DocumentPasteEdit = DocumentPasteEdit> {
45
+
46
+ /**
47
+ * Optional method invoked after the user copies text in a file.
48
+ *
49
+ * This allows the provider to attach copy metadata to the {@link DataTransfer}
50
+ * which is then passed back to providers in {@linkcode provideDocumentPasteEdits}.
51
+ *
52
+ * Note that currently any changes to the {@linkcode DataTransfer} are isolated to the current editor session.
53
+ * This means that added metadata cannot be seen by other applications.
54
+ *
55
+ * @param document Document where the copy took place.
56
+ * @param ranges Ranges being copied in {@linkcode document}.
57
+ * @param dataTransfer The data transfer associated with the copy. You can store additional values on this for later use in {@linkcode provideDocumentPasteEdits}.
58
+ * This object is only valid for the duration of this method.
59
+ * @param token A cancellation token.
60
+ *
61
+ * @return Optional thenable that resolves when all changes to the `dataTransfer` are complete.
62
+ */
63
+ prepareDocumentPaste?(document: TextDocument, ranges: readonly Range[], dataTransfer: DataTransfer, token: CancellationToken): void | Thenable<void>;
64
+
65
+ /**
66
+ * Invoked before the user pastes into a document.
67
+ *
68
+ * Returned edits can replace the standard pasting behavior.
69
+ *
70
+ * @param document Document being pasted into
71
+ * @param ranges Range in the {@linkcode document} to paste into.
72
+ * @param dataTransfer The {@link DataTransfer data transfer} associated with the paste. This object is only valid for the duration of the paste operation.
73
+ * @param context Additional context for the paste.
74
+ * @param token A cancellation token.
75
+ *
76
+ * @return Set of potential {@link DocumentPasteEdit edits} that apply the paste. Return `undefined` to use standard pasting.
77
+ */
78
+ provideDocumentPasteEdits?(document: TextDocument, ranges: readonly Range[], dataTransfer: DataTransfer, context: DocumentPasteEditContext, token: CancellationToken): ProviderResult<T[]>;
79
+
80
+ /**
81
+ * Optional method which fills in the {@linkcode DocumentPasteEdit.additionalEdit} before the edit is applied.
82
+ *
83
+ * This is called once per edit and should be used if generating the complete edit may take a long time.
84
+ * Resolve can only be used to change {@link DocumentPasteEdit.additionalEdit}.
85
+ *
86
+ * @param pasteEdit The {@linkcode DocumentPasteEdit} to resolve.
87
+ * @param token A cancellation token.
88
+ *
89
+ * @returns The resolved paste edit or a thenable that resolves to such. It is OK to return the given
90
+ * `pasteEdit`. If no result is returned, the given `pasteEdit` is used.
91
+ */
92
+ resolveDocumentPasteEdit?(pasteEdit: T, token: CancellationToken): ProviderResult<T>;
93
+ }
94
+
95
+ /**
96
+ * An edit applied on paste.
97
+ */
98
+ class DocumentPasteEdit {
99
+
100
+ /**
101
+ * Human readable label that describes the edit.
102
+ */
103
+ title: string;
104
+
105
+ /**
106
+ * {@link DocumentPasteEditKind Kind} of the edit.
107
+ *
108
+ * Used to identify specific types of edits.
109
+ */
110
+ kind: DocumentPasteEditKind;
111
+
112
+ /**
113
+ * The text or snippet to insert at the pasted locations.
114
+ */
115
+ insertText: string | SnippetString;
116
+
117
+ /**
118
+ * An optional additional edit to apply on paste.
119
+ */
120
+ additionalEdit?: WorkspaceEdit;
121
+
122
+ /**
123
+ * Controls the ordering of paste edits provided by multiple providers.
124
+ *
125
+ * If this edit yields to another, it will be shown lower in the list of paste edit.
126
+ */
127
+ yieldTo?: readonly DocumentPasteEditKind[];
128
+
129
+ /**
130
+ * Create a new paste edit.
131
+ *
132
+ * @param insertText The text or snippet to insert at the pasted locations.
133
+ * @param title Human readable label that describes the edit.
134
+ * @param kind {@link DocumentPasteEditKind Kind} of the edit.
135
+ */
136
+ constructor(insertText: string | SnippetString, title: string, kind: DocumentPasteEditKind);
137
+ }
138
+
139
+
140
+ /**
141
+ * TODO: Share with code action kind?
142
+ */
143
+ class DocumentPasteEditKind {
144
+ static readonly Empty: DocumentPasteEditKind;
145
+
146
+ // TODO: Add `Text` any others?
147
+
148
+ private constructor(value: string);
149
+
150
+ readonly value: string;
151
+
152
+ append(...parts: string[]): CodeActionKind;
153
+ intersects(other: CodeActionKind): boolean;
154
+ contains(other: CodeActionKind): boolean;
155
+ }
156
+
157
+ interface DocumentPasteProviderMetadata {
158
+ /**
159
+ * List of {@link DocumentPasteEditKind kinds} that the provider may return in {@linkcode DocumentPasteEditProvider.provideDocumentPasteEdits provideDocumentPasteEdits}.
160
+ *
161
+ * The provider will only be invoked when one of these kinds is being requested. For normal pasting, all providers will be invoked.
162
+ */
163
+ readonly providedPasteEditKinds: readonly DocumentPasteEditKind[];
164
+
165
+ /**
166
+ * Mime types that {@linkcode DocumentPasteEditProvider.prepareDocumentPaste prepareDocumentPaste} may add on copy.
167
+ */
168
+ readonly copyMimeTypes?: readonly string[];
169
+
170
+ /**
171
+ * Mime types that {@linkcode DocumentPasteEditProvider.provideDocumentPasteEdits provideDocumentPasteEdits} should be invoked for.
172
+ *
173
+ * This can either be an exact mime type such as `image/png`, or a wildcard pattern such as `image/*`.
174
+ *
175
+ * Use `text/uri-list` for resources dropped from the explorer or other tree views in the workbench.
176
+ *
177
+ * Use `files` to indicate that the provider should be invoked if any {@link DataTransferFile files} are present in the {@linkcode DataTransfer}.
178
+ * Note that {@linkcode DataTransferFile} entries are only created when dropping content from outside the editor, such as
179
+ * from the operating system.
180
+ */
181
+ readonly pasteMimeTypes?: readonly string[];
182
+ }
183
+
184
+ namespace languages {
185
+ /**
186
+ * Registers a new {@linkcode DocumentPasteEditProvider}.
187
+ *
188
+ * @param selector A selector that defines the documents this provider applies to.
189
+ * @param provider A paste editor provider.
190
+ * @param metadata Additional metadata about the provider.
191
+ *
192
+ * @returns A {@link Disposable} that unregisters this provider when disposed of.
193
+ */
194
+ export function registerDocumentPasteEditProvider(selector: DocumentSelector, provider: DocumentPasteEditProvider, metadata: DocumentPasteProviderMetadata): Disposable;
195
+ }
196
+ }
@@ -0,0 +1,61 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+
6
+ declare module 'vscode' {
7
+
8
+ // https://github.com/microsoft/vscode/issues/179430
9
+
10
+
11
+ /**
12
+ * TODO:
13
+ * - Add ctor(insertText: string | SnippetString, title?: string, kind?: DocumentPasteEditKind); Can't be done as this is an extension to an existing class
14
+ * - Update provider to return multiple edits
15
+ */
16
+
17
+ export interface DocumentDropEdit {
18
+ /**
19
+ * Human readable label that describes the edit.
20
+ */
21
+ title?: string;
22
+
23
+ /**
24
+ * {@link DocumentPasteEditKind Kind} of the edit.
25
+ *
26
+ * Used to identify specific types of edits.
27
+ *
28
+ * TODO: use own type?
29
+ */
30
+ kind: DocumentPasteEditKind;
31
+
32
+ /**
33
+ * The mime type from the {@link DataTransfer} that this edit applies.
34
+ *
35
+ * TODO: Should this be taken from `dropMimeTypes` instead?
36
+ */
37
+ handledMimeType?: string;
38
+
39
+ /**
40
+ * Controls the ordering or multiple paste edits. If this provider yield to edits, it will be shown lower in the list.
41
+ */
42
+ yieldTo?: ReadonlyArray<DocumentPasteEditKind>;
43
+ }
44
+
45
+ export interface DocumentDropEditProviderMetadata {
46
+ readonly providedDropEditKinds?: readonly DocumentPasteEditKind[];
47
+
48
+ /**
49
+ * List of {@link DataTransfer} mime types that the provider can handle.
50
+ *
51
+ * This can either be an exact mime type such as `image/png`, or a wildcard pattern such as `image/*`.
52
+ *
53
+ * Use `text/uri-list` for resources dropped from the explorer or other tree views in the workbench.
54
+ *
55
+ * Use `files` to indicate that the provider should be invoked if any {@link DataTransferFile files} are present in the {@link DataTransfer}.
56
+ * Note that {@link DataTransferFile} entries are only created when dropping content from outside the editor, such as
57
+ * from the operating system.
58
+ */
59
+ readonly dropMimeTypes: readonly string[];
60
+ }
61
+ }
@@ -31,6 +31,11 @@ declare module 'vscode' {
31
31
  */
32
32
  kind?: QuickPickItemKind;
33
33
 
34
+ /**
35
+ * The icon path or {@link ThemeIcon} for the QuickPickItem.
36
+ */
37
+ iconPath?: Uri | { light: Uri; dark: Uri } | ThemeIcon;
38
+
34
39
  /**
35
40
  * A human readable string which is rendered less prominent.
36
41
  */
@@ -57,22 +57,23 @@ declare module 'vscode' {
57
57
  export function getWorkspaceFolder(uri: Uri): WorkspaceFolder | undefined;
58
58
 
59
59
  /**
60
- * Make changes to one or many resources or create, delete, and rename resources as defined by the given
61
- * [workspace edit](#WorkspaceEdit).
62
- *
63
- * All changes of a workspace edit are applied in the same order in which they have been added. If
64
- * multiple textual inserts are made at the same position, these strings appear in the resulting text
65
- * in the order the 'inserts' were made. Invalid sequences like 'delete file a' -> 'insert text in file a'
66
- * cause failure of the operation.
67
- *
68
- * When applying a workspace edit that consists only of text edits an 'all-or-nothing'-strategy is used.
69
- * A workspace edit with resource creations or deletions aborts the operation, e.g. consecutive edits will
70
- * not be attempted, when a single edit fails.
71
- *
72
- * @param edit A workspace edit.
73
- * @return A thenable that resolves when the edit could be applied.
74
- */
75
- export function applyEdit(edit: WorkspaceEdit): Thenable<boolean>;
60
+ * Make changes to one or many resources or create, delete, and rename resources as defined by the given
61
+ * {@link WorkspaceEdit workspace edit}.
62
+ *
63
+ * All changes of a workspace edit are applied in the same order in which they have been added. If
64
+ * multiple textual inserts are made at the same position, these strings appear in the resulting text
65
+ * in the order the 'inserts' were made, unless that are interleaved with resource edits. Invalid sequences
66
+ * like 'delete file a' -> 'insert text in file a' cause failure of the operation.
67
+ *
68
+ * When applying a workspace edit that consists only of text edits an 'all-or-nothing'-strategy is used.
69
+ * A workspace edit with resource creations or deletions aborts the operation, e.g. consecutive edits will
70
+ * not be attempted, when a single edit fails.
71
+ *
72
+ * @param edit A workspace edit.
73
+ * @param metadata Optional {@link WorkspaceEditMetadata metadata} for the edit.
74
+ * @returns A thenable that resolves when the edit could be applied.
75
+ */
76
+ export function applyEdit(edit: WorkspaceEdit, metadata?: WorkspaceEditMetadata): Thenable<boolean>;
76
77
 
77
78
  /**
78
79
  * Get a workspace configuration object.
package/vscode.d.ts CHANGED
@@ -49,3 +49,5 @@
49
49
  /// <reference path='./vscode/typings/vscode.proposed.newSymbolNamesProvider.d.ts' />
50
50
  /// <reference path='./vscode/typings/vscode.proposed.env.d.ts' />
51
51
  /// <reference path='./vscode/typings/vscode.proposed.terminalDataWriteEvent.d.ts' />
52
+ /// <reference path='./vscode/typings/vscode.proposed.documentPaste.d.ts' />
53
+ /// <reference path='./vscode/typings/vscode.proposed.dropMetadata.d.ts' />