Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test: Webview persistence api #52849

Closed
2 tasks done
mjbvz opened this issue Jun 25, 2018 · 1 comment
Closed
2 tasks done

Test: Webview persistence api #52849

mjbvz opened this issue Jun 25, 2018 · 1 comment

Comments

@mjbvz
Copy link
Collaborator

mjbvz commented Jun 25, 2018

Test for #49022 #48542

Complexity: 3

Summary
A new api for webview serialization has been added. This allows webviews to both save their state between becoming hidden and visible, as well as saving their state when VS Code restarts

Test
Try adding the two types of persistence to the new webview (you can use the cat coding example for this)

Visibility persistence is implemented using a getState and setState method inside the webview itself:

const vscode = acquireVsCodeApi();
const state = vscode.getState();
vscode.setState({ abc: 123 })

Serialization uses WebviewPanelSerializer and registerWebviewPanelSerializer to register a handler in the extension that can revive a webview from its state.

Things to test:

  • Can you implement the two types of persistence?
  • Does the API documentation make sense? (I'll be writing docs for it too but have not finished these yet)
  • Are there cases where the new APIs may not work?
@mjbvz mjbvz added this to the June 2018 milestone Jun 25, 2018
@isidorn isidorn assigned Tyriar, stevencl and RMacfarlane and unassigned stevencl Jun 26, 2018
@JacksonKearl JacksonKearl assigned JacksonKearl and unassigned Tyriar Jun 26, 2018
@JacksonKearl
Copy link
Contributor

Visibility persistence seems to work well and is easy to implement, Serialization was more difficult to figure out but ended up getting it in the end, with some help. Updating one of the examples to use Serialization would definitely be helpful.

One thing I was expecting but didn't seem to get was persisting the state across closing the tab and reopening it with a command.

@JacksonKearl JacksonKearl removed their assignment Jun 26, 2018
@RMacfarlane RMacfarlane removed their assignment Jun 27, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Aug 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants