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

vscode.previewHtml is deprecated. Need to be replaced with Webview API #23

Closed
muojp opened this issue Mar 20, 2019 · 5 comments
Closed

Comments

@muojp
Copy link
Contributor

muojp commented Mar 20, 2019

VSCode warns us that vsccode-language-review uses deprecated preview API.

VSCode: 1.32.2
image

@muojp
Copy link
Contributor Author

muojp commented Mar 20, 2019

microsoft/vscode#62630

@muojp muojp changed the title vscode.previewHtml deprecated vscode.previewHtml is deprecated. Need to be replaced with Webview API Mar 20, 2019
@muojp
Copy link
Contributor Author

muojp commented Mar 20, 2019

A memo after reading https://code.visualstudio.com/api/extension-guides/webview .

A quick review of current design:

  1. Create a preview panel using vscode.commands.executeCommand('vscode.previewHtml', ...) when user needs a new panel, then VSCode core is responsible for lifecycle of the panel.
  2. Bind preview panels with Re:VIEW documents using URIs
  3. Utilize vscode.TextDocumentContentProvider to 1/ detect changes, 2/ fire convert function, 3/ update content shown in preview panels (content update is done internally by VSCode using URI handling)

What Webview API requires:

  1. Create a preview panel using vscode.window.createWebviewPanel(...)
  2. Programmer is responsible for everything

In short, we would need to adopt Webview like this way:

  • Throw away TextDocumentContentProvider (review: URI scheme handler)
  • Re-bind editor events (onOpen/onChange/onSave) with corresponding preview panels along with vscode.SymbolInformations

@atsushieno
Copy link
Owner

Wow, thanks for the note. I'll take a look hopefully tonight or in a few days.

@atsushieno
Copy link
Owner

okay, after a quick look, this is going to be annoying :p

atsushieno added a commit that referenced this issue Mar 21, 2019
It requires not a small amount of refactoring...
@atsushieno
Copy link
Owner

Fixed. Thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants