Commit Graph

15 Commits

Author SHA1 Message Date
Matt Bierner
7284c3e4c1 Use classes for drop/paste edit types (#151980) 2022-06-13 13:10:07 -07:00
Matt Bierner
d7c90c2b2b Update text editor drop proposal (#151552)
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
2022-06-08 17:44:28 -04:00
Matt Bierner
370dfd5fee Iterate on paste edit provider api (#151477)
* 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
2022-06-08 15:06:55 -04:00
Matt Bierner
e4f7f6a9da Add PasteEditProvider (#107283)
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
2022-05-25 12:27:58 +02:00
Matt Bierner
1c7ab35761 Rename to DocumentOnDropEditProvider (#149730)
This change renames `DocumentOnDropProvider` to `DocumentOnDropEditProvider`. This new name aligns with the existing `DocumentFormattingEditProvider`
2022-05-17 09:26:54 -07:00
Matt Bierner
a6dd083a7e Use / for md paths, even on windows (#149120)
Fixes #149010
2022-05-09 15:22:44 -07:00
Matt Bierner
93fd393a0e Add API proposal for reading files in data transfer (#148596)
* 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

* 💄
2022-05-04 12:59:27 -07:00
Matt Bierner
08e838cba3 Don't encode paths 2022-04-19 10:13:38 -07:00
Matt Bierner
cba0a0e460 Always encode paths dropped in md 2022-04-14 14:55:22 -07:00
Matt Bierner
bba6c56123 Fix dropping image from webpage into markdown files 2022-04-06 14:27:41 -07:00
Matt Bierner
62d6f38fc2 Auto create image links when dropping an image file into markdown 2022-04-05 15:42:56 -07:00
Matt Bierner
032ee47056 Add setting to enable/disable markdown drop into editor
For #142990
2022-04-05 15:42:56 -07:00
Matt Bierner
44ffeba237 Switch to provider based model for on drop
This simplifies implementing the provider and also give potentially gives us more control over how the drop happens
2022-04-01 15:51:38 -07:00
Matt Bierner
5451119820 Adopt SnippetTextEdit for drop 2022-04-01 15:51:38 -07:00
Matt Bierner
7736c87cb0 Move markdown preview files to own folder 2022-03-29 13:25:35 -07:00