Add webview restoration api proposal#46380
Conversation
|
@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. |
|
@jrieken Please take a look at the new
|
|
Looks good. Yeah, I think the de/serialise-functions should be async (but maybe time-boxed). We already have the |
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
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
statefield on webviews. This is a json serializable blob of dataAdds a new
WebviewReviverinterface (name will probably change). This binds a specific viewType to a provider that can restore a webview's contents from itsstateIn 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:viewTypeactivation event.Current implementation is sort of a mess. Will try to clean things up