Commit Graph

248 Commits

Author SHA1 Message Date
Baptiste Augrain
6e76e0e1b7 feat: select the folding provider to use (#157434)
* 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>
2022-10-23 15:45:34 +02:00
Johannes Rieken
0dd2dc89d2 hook up unhandled extension errors with extension telemetry (#163424)
* hook up unhandled extension errors with extension telemetry

* fix layering

* forward unhandled language provider errors to extension telemetry loggers
2022-10-13 09:04:08 -04:00
Johannes
20527c05a3 move SnippetTextEdit into vscode-dts
https://github.com/microsoft/vscode/issues/145374
2022-09-08 14:39:26 +02:00
Matt Bierner
f86ceb6749 Use ids instead of indexes for resolving data transfer files (#160349)
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
2022-09-07 13:18:49 -07:00
Matt Bierner
342394d1e7 Use optional chaining for more method calls (#156938)
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
2022-08-03 01:56:56 +02:00
Matt Bierner
c07ff2eb1d Remove types.isArray (#156930)
This function was simply calling Array.isArray
2022-08-03 01:53:57 +02:00
Matt Bierner
7f6984e71b Fix copy paste for files (#155915)
This fixes the copy paste proposed api to correctly support pasting of files and file data
2022-07-21 16:49:25 -07:00
Matt Bierner
c9bf4393d5 Rename drop API interface (#154876)
Makes the names more consistent
2022-07-12 11:33:13 +02:00
Johannes Rieken
e5f5a16b74 joh/issue145374 (#154360)
* enroll more places into `snippetWorkspaceEdit` proposal,

https://github.com/microsoft/vscode/issues/145374

* tweak API proposal for snippet edits, make this `WorkspaceEdit` only, remove old proposal bit

https://github.com/microsoft/vscode/issues/145374
2022-07-07 12:55:51 +00:00
Matt Bierner
f17b33faf2 Use .?method() in more places (#152112)
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
2022-06-15 16:28:31 +00:00
Johannes
3622010b64 Merge branch 'main' into joh/voluminous-lobster 2022-06-09 09:08:20 +02: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
Johannes
0656d21d11 auto-fixed prefer-const violation 2022-06-08 17:49:21 +02: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
91923bab48 Cleanup data transfer types (#149774)
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
2022-05-23 23:28:02 +00: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
Henning Dieterichs
f98ae66391 Merge pull request #148767 from microsoft/hediet/inline-completion-update
Updates inlineCompletions proposal from inlineCompletionsNew proposal.
2022-05-05 13:51:21 +02:00
Henning Dieterichs
bae40168ae Fixes issues from code review 2022-05-05 09:54:41 +02:00
Henning Dieterichs
3b08d52d0b Updates inlineCompletions proposal from inlineCompletionsNew proposal.
Also moves InlineCompletionList.commands to inlineCompletionsAdditions proposal.
2022-05-05 07:49:38 +02: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
Johannes
c4dd43dd79 💄 2022-04-14 14:53:24 +02:00
Henning Dieterichs
841c777ad8 Introduces InlineCompletionList.commands and improves documentation comments. 2022-04-12 19:32:40 +02: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
Henning Dieterichs
e18e7972ad Fixes a bug that prevented new proposed inline completion API from working. 2022-03-25 11:16:43 +01:00
Johannes
a6965fbd4d don't log link detection in extension host language features, https://github.com/microsoft/vscode/issues/145882 2022-03-23 14:35:31 +01:00
Henning Dieterichs
ba356dc428 Adopt filter text in proposed extension API. 2022-03-17 19:49:55 +01:00
Henning Dieterichs
827371128b 💄 2022-03-17 17:35:06 +01:00
Henning Dieterichs
3626e6ab0c Adds inlineCompletionsNew and inlineCompletionsAdditions proposed APIs to avoid breaking changes when finalizing inline completions API. 2022-03-10 11:23:01 +01:00
Henning Dieterichs
5f8dacf8a2 Adds support for snippets in inline completions (fixes #138260) 2022-03-02 16:02:51 +01:00
Johannes Rieken
778b74a215 adding InlayHint#textEdits, https://github.com/microsoft/vscode/issues/141576 2022-03-01 18:24:15 +01:00
Johannes Rieken
261adce05c remove InlayHint#command for now, https://github.com/microsoft/vscode/issues/141576, https://github.com/microsoft/vscode/issues/143740 2022-02-24 15:00:46 +01:00
Henning Dieterichs
5163f619ea Adresses feedback inline completion API discussion. 2022-02-09 15:30:26 +01:00
Johannes Rieken
765d2ef252 add doc for padding-left/right, add doc for inlay hint kind but also remove InlayHintKind#other, https://github.com/microsoft/vscode/issues/16221 2022-02-08 18:37:43 +01:00
Johannes Rieken
627d46551d support double click gesture on inlay hints, API polish, https://github.com/microsoft/vscode/issues/16221 2022-02-05 14:25:37 +01:00
Alex Dima
6136c815bc Renames 2022-02-04 15:01:44 +01:00
Johannes Rieken
e0aade162d race providers against cancellation so that cancelled requests dont reply with a full result but with a cancellation error. fyi @hediet added external error handling to inline completions 2022-02-04 09:38:42 +01:00
Johannes Rieken
f933065f53 more cancellation handling on the ext host, https://github.com/microsoft/vscode/issues/140557 2022-02-03 16:31:41 +01:00
Johannes Rieken
4a130c40ed enable @typescript-eslint/member-delimiter-style, https://github.com/microsoft/vscode/issues/140391 2022-02-02 14:35:33 +01:00
Johannes Rieken
ffdeff7b55 show error when inlay hints command fails, annotate error with source (e.g extension name), fixes https://github.com/microsoft/vscode/issues/141588 2022-01-27 10:47:15 +01:00
Henning Dieterichs
9c468f3d03 Implements #136452 by introducing the flag completeBracketPairs for inline completions. 2022-01-24 09:53:47 +01:00
Alex Dima
d8ca757f2b Move ISingleEditOperation to /core/ (#141174) 2022-01-21 20:35:35 +01:00
Johannes Rieken
a24000a9a3 For parts with location and command: give link gesture to location and append command to context menu, add more jsdoc for API, remove dead code, https://github.com/microsoft/vscode/issues/16221#issuecomment-264527520 2022-01-20 14:47:05 +01:00
Johannes Rieken
15db136c3c use Dto<T> util in more places, some clean-up/alignment of caching logic 2022-01-19 15:12:22 +01:00
Johannes Rieken
d4dde3aa06 support label part tooltip in addition to item tooltip, https://github.com/microsoft/vscode/issues/16221#issuecomment-264527520 2022-01-19 13:54:35 +01:00
Johannes Rieken
8ef8933a1a incorporate API feedback, https://github.com/microsoft/vscode/issues/16221 2022-01-19 09:23:48 +01:00
Johannes Rieken
f30e6a710d make trace provider logging more minification friendly 2022-01-18 14:47:05 +01:00
Johannes Rieken
7718b8ef72 make token to race against mandatory optional, https://github.com/microsoft/vscode/issues/140557 2022-01-18 13:38:56 +01:00
Johannes Rieken
56a830bc68 on ext-host race selection ranges, workspace symbols, and document symbols against cancellation, https://github.com/microsoft/vscode/issues/140557 2022-01-18 13:33:07 +01:00
Johannes Rieken
57eaad7de3 on the ext-host, race call and type hierarchy against cancellation so save bandwidth, https://github.com/microsoft/vscode/issues/140557 2022-01-18 13:25:20 +01:00