Description
openedon Feb 24, 2020
Test for #77131
Complexity: 5
(Note: please hold off on testing this until Wednesday. We will be reviewing the API at the API sync and it may change before then)
Background
We've made some significant changes to the webview editor API proposal this iteration:
-
There are now two types of webview editors and two contributions for them:
-
Text based webview editors use a
TextDocument
as their model. -
Custom webview editors let extensions provide their own model. This is provided using a
WebviewEditorCustomDocument
-
-
We've also added a
backup
method for custom editors to support hot exit
You can find examples of these two editors types here: https://github.com/mjbvz/vscode-experimental-webview-editor-extension
Testing
Try implementing both a text based webview editor an a fully customizable editor.
With the text based webview editor, some areas to explore:
- You can register your webview editor, it is activated as expected, and it receives the expected
TextDocument
object - You can use the
Reopen with...
command to switch between your webview and the text document. No content should be lost during this change.
With the custom webview editor, verify that:
- Your custom documents have the expected lifecycle
- A custom document should be created when you first open a file.
- That document should be re-used as more editors are opened for that resource
- If you close all editors, the custom document should be disposed of
- At which point, opening the resource again should trigger a new document to be created.
- Your webview gets the expected undo, apply, save events.
- Your extension is called as expected to perform hot exit actions
Overall, looks to see:
- Does the api documentation make sense
- Are there any apis you wish you had to implement your extension?