Currently our data transfer implementation only allows a single entry of each mimeType. There can only be a single `image/gif` file for example.
However this doesn't match how the DOM apis work. If you drop multiple gifs into VS Code for example, the DataTransfer you get contains entries for each of the gifs.
This change allows us to also support DataTransfers that have multiple entries with the same mime type. Just like with the DOM, we support constructing these duplicate mime data transfers internally, but do not allow extensions to create them
As part of this change, I've also made a few clean ups:
- Add helpers for creating dataTransfer items
- Clarify when adding a data transfer item should `append` or `replace`
- Adopt some helper functions in a few more places
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
* Finalize NotebookEditor api proposal
Fixes#149271
This finalizes most parts of the NotebookEditor api proposal. I haven't removed the proposal entirely as there are still a few parts being left behind:
- The deprecated properties/functions
- A few contribution points such as `notebook/cell/executePrimary`
* remove extra quote
- Add `insertCells` helper
- Add a `newNotebookMetadata` property for setting the metadata for the entire notebook
- Add a `NotebookEdit.updateNotebookMetadata` helper
- Remove the previous `WorkspaceEdit.updateNotebookMetadata` function since you can now use `NotebookEdit.updateNotebookMetadata`
* Add drop into editor option
This change adds a new `enableDropIntoEditor` editor option that enables/disables dropping an extermal resources into an editor
Previously this option was exposed `IEditorConstructionOptions`, however this did not correctly disable drop into editor when dragging and dropping unknown types (such as dragging emoji from the MacOS emoji panel)
With this change, disabling `workbench.editor.dropIntoEditor.enabled` should fully disable the new drop into behavior
* Move drop into editor from workbench to editor
This moves the `dropIntoEditorContribution` from the workbench layer to the platform layer
As part of this change, I also add to move `extractEditorsDropData` up to `platform` so that it could be used from the `editor` layer
This change also enables drop into for the SCM message box
* Fixing monaco errors
* Revert id change
* Add notebookWorkspaceEdit api proposal
Splits a new `notebookWorkspaceEdit` out of the existing `notebookEditorEdit` proposal.
The notebookWorkspaceEdit reflects the api that we believe should be finalized instead of `notebookEditorEdit`. It lets extensions use workspaceedits to change cells in a notebook or replace the metadata for a notebook document
As part of this change, I've also marked all of the `notebookEditorEdit` apis as deprecated (except for `replaceNotebookMetadata` which exists in the new proposal too)
* Export type from extHost
* Remove the textDocumentNotebook API proposal
All consumers have now been migrated off of this proposal, so it is safe to remove from our code
* Remove deprecated api usage from test
- Introduce policy configuration using policy model
- Use policy configuration while reading, inspecting and writing configuration
- Adopt json settings editor
* 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
* 💄
* use glob on tasks otherwise fallback to default
* add support for test commands also
* try to find one globbed task otherwise fallback to defaults
* - get relativePath (but fallback to absolute if outside of workspace)
- bring back json schema
* Refactor and reduce duplicate code
* remove glob, make isDefault a string or boolean
* update taskConfig
* - rebase
- type updates
- splitPerGroupType should check explicitly for true on isDefault
- hygiene check
* Remove task glob from API
* Task group DTO updates
* Make sure globs run ahead of default task if there's multiple globs matching
* Style and name changes
* More naming and code re-use
* Glob doesn't work when only 1 glob match
Co-authored-by: Alex Ross <alros@microsoft.com>