* feat: support extension id in property `editor.foldingStrategy`
* work in progress
* use new setting 'editor.defaultFoldingRangeProvider' defined in workspace
* revert editorOptions changes
Co-authored-by: Martin Aeschlimann <martinae@microsoft.com>
When an extension needs to read a data transfer file, we were previously using the index of the item. This is unreliable as it means we have to ensure the array of data transfer items never changes order
With this PR, i've switched us to use a unique `id` instead
This rewrites code such as:
```ts
if (thing) {
thing.method();
}
```
To the more concise:
```ts
thing?.method();
```
This was done using a simple find replace. I tried to keep the change pretty conservative so it only touches simple cases like above
Switches simple patterns like:
```ts
if (some.thing) {
some.thing.method();
}
```
to:
```ts
some.thing?.method()
```
This is more concise and avoids having to repeat the `some.thing` part
This updates the text editor drop proposal (#142990). This change introduces `DocumentDropEdit` which removes the need for `SnippetTextEdit`. This interface may also be extended in the future with additional metadata
* Iterate on paste edit provider api
For #30066
- Pass all selections to paste providers. For #151326
- Introduce `DocumentPasteEdit` as return type. This new type uses an `insertText` that is applied to every paste location (for multicursor), plus an optional additional edit
- Add `DocumentPasteProviderMetadata`. This lets extensions tell us which types of mimetypes they are interested in, letting us avoid round trips if no extensions care about the pasted data
* Correctly batch insertText
For #30066
This adds a new `documentPaste` api proposal that lets extensions hook into copy and paste.
This can be used to do things such as:
- Create link when pasting an image
- Bring along imports when copy and pasting code
This change attempts to clean up our internal data transfer types
- Replace `IDataTransfer` (which was just an alias for map) with a `VSDataTransfer` helper class.
This lets us add helpers and also restrict what you can do on a datatransfer
- Move `DataTransferDTO` types into `protocol`
- Move `DataTransferTypeConverter` into `typeConvert`
- Don't return internal types to ext host callers
For example, previously we leaked `IDataTransfer` out into providers / controllers. Instead we should always return an instance of `vscode.DataTransfer` to extensions
* Add experimental support for reading files in data transfer
Adds a new `DataTransfer.asFile` method which lets you get file objects from a `DataTransfer`. This is currently only hooked up for drop into editors.
A few follow ups:
- Right now the file data is also read eagerly when it is transfered to the extension host. Before shipping this we would make this happen lazily instead
- The drop into editor api does not provide a nice way to do anything with the dropped files.
We should at least support returning a `WorkspaceEdit`. However `WorkspaceEdit` only supports text files, so we would also need to add an API that lets it deal with binary files
* Make `asFile` return a value instead of a promise
`asFile().data()` already returns a promise so `asFile` doesn't also need to be async
* Trying resolving data files transfer lazily
* Cleaning up code for lazy drop
* Remove testing code
* Remove unneeded buffer serialize
* 💄