Skip to content

Add webview restoration api proposal - #46380

Merged
Matt Bierner (mjbvz) merged 6 commits into
microsoft:masterfrom
mjbvz:webview-revive
Apr 4, 2018
Merged

Matt Bierner (mjbvz) merged 6 commits into
microsoft:masterfrom
mjbvz:webview-revive

Conversation

@mjbvz

@mjbvz Matt Bierner (mjbvz) commented Mar 23, 2018 •

Copy link
Copy Markdown
Contributor

From #45994

Adds an experimental API that allows extensions to persist webviews and restore them after vscode restarts. Uses this api to restore markdown previews.

This is done by:

  • Adding a new state field on webviews. This is a json serializable blob of data

  • Adds a new WebviewReviver interface (name will probably change). This binds a specific viewType to a provider that can restore a webview's contents from its state

  • In VS Code core, persist webview editors. When we restart and need to show a webview, activate all extensions that may have revivers using the onView:viewType activation event.

Current implementation is sort of a mess. Will try to clean things up

@jrieken

Copy link
Copy Markdown
Contributor

Matt Bierner (@mjbvz) What do you want me to review here? I think we discussed the API and I still think over-eager state synchronisation isn't the way to go but an explicit hook is way better. For the rest - I am not familiar with the code around webview editor et al anymore.

@mjbvz Matt Bierner (mjbvz) added this to the April 2018 milestone Mar 26, 2018
@mjbvz Matt Bierner (mjbvz) changed the title First attempt at webview restoration api Add webview restoration api proposal Apr 3, 2018
@mjbvz

Matt Bierner (mjbvz) commented Apr 3, 2018 •

Copy link
Copy Markdown
Contributor Author

Johannes Rieken (@jrieken) Please take a look at the new vscode.proposed.d.ts API. A few questions:

  • How does the serializer api look?

  • Should serializeWebview and deserializeWebview be async?

  • Should our activation events make it clear that these are webview activations? The current activation event is: "onView:markdown.preview". We could change this to something like: "onWebbiew:markdown.preview" or "onView:webview.markdown.preview"

@jrieken

Copy link
Copy Markdown
Contributor

Looks good. Yeah, I think the de/serialise-functions should be async (but maybe time-boxed). We already have the onView-event and for the sake of simplicity I'd stick with that, like onView:markdown.preview

Matt Bierner added 6 commits April 3, 2018 18:04
From microsoft#45994

Adds an experimental API that allows extensions to persist webviews and restore them even after vscode restarts. Uses this api to restore markdown previews. This is done by:

- Adding a new `state` field on webviews. This is a json serializable blob of data
- Adds a new `WebviewReviver` interface (name will probably change). This binds a specific viewType to a provider that can restore a webview's contents from its `state`
- In VS Code core, persist webview editors. When we restart and need to show a webview, activate all extensions that may have reviviers for it using the `onView:viewType` activation event.

Current implementation is sort of a mess. Will try to clean things up
@mjbvz
Matt Bierner (mjbvz) merged commit dd21d35 into microsoft:master Apr 4, 2018
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants