Commit Graph

119 Commits

Author SHA1 Message Date
Matt Bierner
5ec2e40b21 Fixing webview getting disposed after rename
For #83961
2019-11-25 22:38:02 -08:00
Matt Bierner
750f28769d Sync custom editor edits
If multiple instances of the same  custom editor are opened for the same resource, the edit stack should be shared between them. This matches how we work with text files
2019-11-25 15:44:25 -08:00
Matt Bierner
f3d70dbf92 Working on sharing models for same custom editor 2019-11-25 15:44:25 -08:00
Matt Bierner
b52f1c7dae Trying to hook up background to implement custom editor rename 2019-11-25 15:44:25 -08:00
Matt Bierner
ffe3749d5a Working on hooking up custom editor saveAs 2019-11-25 15:44:25 -08:00
Matt Bierner
9b89cca38e Working on hooking up revert properly for custom editors 2019-11-22 15:18:01 -08:00
Matt Bierner
8bbe3157f0 Trying to hook up basic save for custom editors 2019-11-18 11:27:45 -08:00
Matt Bierner
27a33ee6fe Hook up very basic undo/redo for webview editors
For #77131
2019-11-15 18:21:46 -08:00
Matt Bierner
7ac686d6cc Working on hooking up undo/redo for custom editors 2019-11-15 15:53:25 -08:00
Matt Bierner
7e71822af3 Hook up CustomEditorModel to workingCopyService 2019-11-12 15:54:32 -08:00
Matt Bierner
278b4f8cfa Hookup experimental undo for customEditors
This currently is not connected to any actual actions in the editor
2019-11-07 17:22:21 -08:00
Matt Bierner
bca7206f59 Forward onEdit from webviewEditor to mainthread 2019-11-07 15:57:47 -08:00
Matt Bierner
dcecb9eea6 Documenting thoughts on direction for custom editor API
This documents the current thinking on the custom editor api. The current api proposal is not actually implemented yet
2019-11-04 15:11:54 -08:00
Benjamin Pasero
d3972c622f opener - adopt fromUserGesture in more places 2019-10-18 16:16:33 +02:00
Matt Bierner
d6ab43118d Create WebviewExtensionDescription in extHostProtocol 2019-10-17 10:50:34 -07:00
Matt Bierner
721886ce10 Allow registerWebviewEditorProvider to pass in a set of initial webview options
Fixes #82128
2019-10-17 10:50:34 -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
dc9ca65375 Use instanceof checks 2019-10-15 11:31:25 -07:00
Matt Bierner
e08b22ba73 Extract reviveWebviewExtension 2019-10-15 11:31:25 -07:00
Matt Bierner
c142b04817 Prefer using the name webviewInput for variables that manage WebviewInput objects 2019-10-15 11:31:24 -07:00
Matt Bierner
019bce14ec Remove extra handler for onDidUpdateState
The current implementation is a noop since we've already updated the state when it is invoked
2019-10-15 11:31:24 -07:00
Matt Bierner
431f446b5b Use Schemas 2019-10-15 11:31:24 -07:00
Matt Bierner
1c2e5df289 Convert static class to constant 2019-10-15 11:31:24 -07:00
Matt Bierner
01dcd28add Extract InternalWebviewViewType 2019-10-15 11:31:24 -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
9c3d060aff Rename webviewEditorService to webviewWorkbenchService
This matchs the naming of a few other services we have
2019-10-10 14:16:26 -07:00
Matt Bierner
d3eb24828e Use strict compare for checking if an editor is active/visible
Fixes #81889

Using `.matches` can cause a custom editor to match all custom editors for that resource. Use a strict compare instead.
2019-10-03 13:53:30 -07:00
Matt Bierner
af070ee0a0 Move custom editor extension activation out of input
Inputs should not need to know about extensions
2019-10-01 15:05:22 -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
fd9528257e Make sure we use consistent unique ids for custom editors 2019-09-25 16:25:39 -07:00
Matt Bierner
79dbd4d7c0 Replace todo 2019-09-23 10:58:21 -07:00
Matt Bierner
e62f2e3e2e Only require a reviver being registered to revive a webview
Fixes #80184

Don't rely on a state being set as well
2019-09-23 10:58:21 -07:00
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