Commit Graph

36 Commits

Author SHA1 Message Date
Matt Bierner
ad1cb1f661 Make sure exthost has same id for webview as main thread 2019-09-19 10:31:37 -07:00
Benjamin Pasero
fd32392699 debt - common/product => common/productService 2019-09-16 11:31:22 +02:00
Matt Bierner
5b4776fcf6 Make webview editor state updates handle diff editors 2019-09-13 23:07:33 -07:00
Matt Bierner
58b2640720 Use uuid instead of incremental counter for webview ids 2019-09-13 22:27:17 -07:00
Matt Bierner
4546a07196 Working on basic save for custom editors 2019-09-13 22:24:35 -07:00
Matt Bierner
25c054b034 WebviewEditorInput -> WebviewInput 2019-09-13 15:00:26 -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
8532eb3206 Remove old-style webview state migration code 2019-09-11 20:44:20 -07:00
Matt Bierner
2d3727b3b1 Push editorResource concept back into CustomFileEditorInput 2019-09-10 18:32:56 -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
9f49056ec7 Only allow protocol links in webview on desktop VS Code
Fixes #79647
2019-08-26 13:42:41 -07:00
Matt Bierner
2637bf2bf5 Remove extra conditional guard
strict null checks should prevent calling this function with undefined
2019-08-21 14:24:33 -07:00
Matt Bierner
6c92c45dec Remove extra conditional
This value should always be a number
2019-08-21 14:24:33 -07:00
Matt Bierner
6e530127a1 Make sure we update the webview's internally tracked group for restoration 2019-08-20 16:32:23 -07:00
Matt Bierner
d241987248 Use bi-direcitonal map for mapping webviews to handles 2019-08-20 16:27:43 -07: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
4d9460470a Simplify csp for getDeserializationFailedContents
This page should never contain anything except text
2019-08-20 16:05:11 -07:00
Matt Bierner
1c05a14d3c Don't track webviews separately from inputs
The webviews should always be accessible through the inputs
2019-08-20 16:00:23 -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
df0dd2edc2 Move webview into browser
Fixes #79424

This file depends on dom api so it should live in browser instead of common
2019-08-19 21:06:47 -07:00
Sandeep Somavarapu
8095541d7d inline product configuration in produt service 2019-08-15 16:08:11 +02:00
Sandeep Somavarapu
e0a685e585 expose product configuration in product service 2019-08-14 18:21:58 +02:00
Matt Bierner
0366e573f5 Track editor inputs and webview separately 2019-07-22 16:24:53 -07:00
Matt Bierner
928ae46457 Rewrite how webviews are managed internally
This change attempts to do the following:

- Encapsult most of the logic for handling the webviews used for webview editors into a new WebviewEditorOverlay class
- Greatly simplify WebviewEditorInput and make it take a webview when it is created
- Move the webview creation logic up into the webviewEditorService instead of having it be inside the webviewEditor class itself

This aim of these changes is to make it possible to re-use more of the webview logic for custom editors
2019-07-17 18:14:08 -07:00
Matt Bierner
8b69b981de Simplify state used for webviews
We previously used nested states to store some additional metadata alongside the real webview state. This is overly complicated. This change switches us to using a single top level state field, while also adding some code to handle migration from the old state structure
2019-07-17 18:14:08 -07:00
Matt Bierner
4629479920 Don't require using state to check if we can revive 2019-07-17 18:14:08 -07:00
Matt Bierner
e26db506b7 Mark that state may be undefined 2019-07-17 18:14:08 -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
f57ff0b25c Remove webview _onBeforeShutdown
This should no longer be required
2019-07-10 11:55:37 -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
Benjamin Pasero
998a65e2ca web - best lifecycle support we can do currently 2019-06-18 15:12:46 +02:00
Matt Bierner
e7a5f9a5e2 Remove the vscode-core-resource scheme
This is no longer required and complicates loading of resources. Use the standard `vscode-resource` scheme instead
2019-06-12 11:17:59 -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
Alex Dima
022835ea42 Connect to the remote extension host 2019-05-24 18:33:29 +02:00