Commit Graph

27 Commits

Author SHA1 Message Date
Matt Bierner
31506b5899 Remove old portMapping api conversion logic 2019-10-15 11:31:25 -07:00
Matt Bierner
d4cebcd450 Move filling in of default localResourceRoots into extHost
The main VS Code process should not need to know about the default values for `localResourceRoots`. Leave this up to the extension instead
2019-10-15 11:31:25 -07:00
Matt Bierner
48195455a1 Remove the setExtension helper
Instead pass over the extension when resolving the extension itself
2019-10-15 11:31:24 -07:00
Matt Bierner
6fdd8d10dc Fixing strict init errors in webview code
#78168
2019-10-07 16:38:17 -07:00
Matt Bierner
313ede61cb Also remove extHostWebview side of the api proposal for webview editor state/save 2019-09-30 20:36:21 -07:00
Matt Bierner
e904a5f646 Warn development webview extensions that use vscode-resource uris directly
Fixes #81685
2019-09-30 14:22:47 -07:00
Matt Bierner
e0762af258 Move webview content state into webviewPanel instead of webviewEditor
Split out from #77131

The current webview editor api is very procedural. This model has some problems when it comes to supporting editing resources, but actually does make a lot of sense for webviews that aren't backed by real file system resources. For example, if you have a webview that edits some document in the cloud, you should not be required to implement a custom file system provider just to enable basic saving.

This change moves the `onWillSave` and `webviewEditorState` properties back onto `WebviewPanel` instead of keeping them specific to `WebviewEditor`. The save implementation does not fully work yet, as the will require #81521
2019-09-26 18:05:37 -07:00
Matt Bierner
0506f7f736 Make sure image views (and custom editors) work properly on the web
This fixes an issue where webviews for custom editors did not have any associated extension information, which caused them try reading `file:` uri resources instead of remote uri resources
2019-09-25 16:25:39 -07:00
Matt Bierner
1ee616d802 Don't duplicate external webview commit in so many places 2019-09-16 14:19:16 -07:00
Matt Bierner
4546a07196 Working on basic save for custom editors 2019-09-13 22:24:35 -07:00
Matt Bierner
54ac29790e Make sure asWebviewUri also handles replacing commit 2019-09-12 16:07:47 -07:00
Matt Bierner
7a219ab632 Adding concept of a state for webview editors
#77131

This information will be used to show the dirty indicator and also enable/disable save
2019-09-12 14:04:54 -07:00
Matt Bierner
011836a150 Prototyping custom editors (#77789)
* Custom Editor exploration

For #77131

Adds a prototype of custom editors contributed by extensions. This change does the following:

- Introduces a new contribution point for the declarative parts of a custom editor
- Adds API for registering a webview editor provider. This lets VS Code decided when to create a webview editor
- Adds an `openWith` command that lets you select which editor to use to open a resource from the file explorer
- Adds a setting that lets you say that you always want to use a custom editor for a given file extension
- Hooks up auto opening of a custom editor when opening a file from quick open or explorer
- Adds a new extension that contributes a custom image preview for png and jpg files

Still needs a lot of UX work and testing. We are also going to explore a more generic "open handler" based approach for supporting custom editors

Revert

* Re-use existing custom editor if one is already open

* Don't re-create custom editor webview when clicking on already visible custom editor

* Move customEditorInput to own file

* First draft of serializing custom editor inputs

* Use glob patterns instead of simple file extensions for matching custom resoruces for custom editors

* Add descriptions

* Try opening standard editor while prompting for custom editor

* Make sure we hide image status on dispose

* Make sure we restore editor group too

* Use glob patterns for workbench.editor.custom

* Allow users to configure custom editors for additional file types

* Use filename glob instead of glob on full resource path

* Adding placeholder for prompt open with

* Add enableByDefault setting for editor contributions

* Enable custom editors by default and add `discretion` enum

Changes `enableByDefault` boolean to a `discretion` enum. This should give more flexibility if we want other options (such as forcing a given custom editor to always be used even if there are other default ones)

* Allow custom editors to specify both a scheme and filenamePattern they are active for

* Rework custom editor setting

* Don't allow custom editors to be enabled for all resources by a config mistake

* Replace built-in image editor with one from extension

* Adding reopen with command

* Improve comment

* Remove commented code

* Localize package.json and remove image

* Remove extra lib setting from tsconfig
2019-09-10 17:56:57 -07:00
Matt Bierner
78879b6a81 Log missing csp on extension host instead of main window 2019-08-26 15:42:16 -07:00
Matt Bierner
4b93194b76 Make sure we notify webview of view state changes in a consistent order
Send events in the following order:
- Non-visible
- Visible
- Active

This matches the old notification order for webviews
2019-08-23 22:27:51 -05:00
Matt Bierner
b1dd95c883 Fire a single batched event internally to update all webview view states
Previously we fired one event per webview. This change switches to fire on event per update
2019-08-20 16:20:42 -07:00
Matt Bierner
5e57212107 Better handle cases where webview view state in api can get out sync with real view state
Fixes #79492

Simplifies view state management logic in `mainThreadWebviews` to:

* Not be stateful
* Handle cases where a webview's view state changes through a more complex means (see #79492 for an example of this)
2019-08-20 15:57:06 -07:00
Matt Bierner
c5dc9d16be Finalize asWebviewUri api
Fixes #79242

As discussed, renames `toWebviewResource` to `asWebviewUri` to be consistent with the `asAbsolutePath` api naming
2019-08-19 20:18:26 -07:00
Matt Bierner
5106b556bd Support loading webviews from wildcard endpoints
Fixes #77132

Add support for loading webviews from and endpoint that looks like:

```
https://{{uuid}}.contoso.com/path/to/some/commit/index.html
```

This lets us serve each webview from a seperate origin
2019-07-12 15:38:12 -07:00
Matt Bierner
ca7605f339 Use a uuid as our webview handles
Avoid having duplicated ids/handles
2019-07-10 11:55:37 -07:00
Matt Bierner
c01a3a718d Use clearer name for csp webview element
#76489
2019-07-09 11:45:20 -07:00
Matt Bierner
f963c9a2a8 Adding tests and changing how toWebviewResource works
- Allow placeholders in the webviewEndpoint. This is required to support serving each webview from its own origin
- Add tests for toWebviewResource
2019-07-09 11:45:10 -07:00
Matt Bierner
a558a9504a Adding toWebviewResource api
For #76489
2019-07-08 18:38:47 -07:00
Matt Bierner
8119b4aee7 Move the webviewResourceRoot property to be set on each webview instead of as a global property
For #72155

This allows  us to potentially change the resource root per webview
2019-06-24 17:07:06 -07:00
Johannes Rieken
6f1da34c2e debt - decouple webviews from code insets, move things to /browser/-layer, change inset api proposal to push style, re #66418 2019-06-04 12:31:18 +02:00
Matt Bierner
94ba9cfe20 Finalizing webview port mapping api
Fixes #72152
2019-04-15 11:01:19 -07:00
Johannes Rieken
c0821aa5e9 move extHost-files to common 2019-04-10 10:26:52 +02:00