Closed AlexPiro closed 4 years ago
same
+1
Windows 10 (17763) VSCode 1.38.0
This is likely caused by #9. Please consider helping out the extension author with a PR that migrates this extension to use webviews
I took a quick peek at this. The way this currently works is that TextDocumentContentProvider
is subclassed so that the HTML can be served through a virtual URI. The JS dependencies are included by src and proxied through the provided.
webview
doesn't allow URI navigation. Once a webview panel is created, the HTML string must be assigned to the html
property directly. Also, the only examples of JS I found in the webview
docs show inlining code in the script tags. If file://
includes don't work they will probably have to be read from disk and injected into the HTML template.
See this guide on how to load local resources: https://code.visualstudio.com/api/extension-guides/webview#loading-local-content
I didn't get very far: https://github.com/stef-levesque/vscode-3dviewer/compare/master...deckar01:10-webview
I'm really only getting feedback from the compiler. When I debug the extension there is no indication that the extension is actually running when an STL file is opened.
Edit: I got compiler errors indicating that the version of typescript was too old for the version used in vscode now. Updating that package started causing the package to produce different errors about data structures between vscode's version of typescript and the version install for this package.
Tengo un modelo en formato .obj pero no consigo ver la preview gráfica. ¿alguna sugerencia? Gracias
@deckar01 Seems like you're the only one who tried it. I'm not sure that you didn't get far. Any chance you'll try again? I'll bounty a dinner.
I got past the basic previewHTML to webview conversion, but webviews broke many more things:
https://github.com/stef-levesque/vscode-3dviewer/compare/master...deckar01:10-webview-2
I had to comment out the usage of several basic browser features that VSCode's webview does not allow. Each time I would hit a missing feature, I would find a corresponding VSCode issue about it that ended with @mjbvz saying there is a native VSCode alternative and no interest in supporting the browser functionality. The features are enabled in the browser engine, VSCode just will not expose the arguments in their options API so that developers can use them. There are too many libraries in this project that rely on web standards to port all of them to VSCode. This kind of vendor lock in is anti-open source. I will be replacing VSCode and no longer contributing to this project. Good luck.
Such as? If you’re talking about native pop ups (alerts, prompts), yes those are not supported. They look out of place visually in VS Code, feel out of place because normal keybindings and such don’t work, and let the web view block interaction with the entire editor
That’s why we want you to use the normal VS Code UI instead. You can overwrite window.alert if some library you use depends on it
@deckar01 Thanks for retrying and the quick response. If you have any concrete links to issues that would be appreciated. I would be interested in this discussion.
Hey, sorry for not maintaining the repo over the last few months.
I've stop trying to support webview, and now focus on using custom editor in the custom-editorbranch
I'll submit a fix for the extension when the proposed API is approved
I overwrite alert
and confirm
with the functions from top
. So far this works fine.
// VSCode webview doesn't support modal window
window.alert = top.alert;
window.confirm = top.confirm;
Version 0.2.0 of the extension has just been pushed, you can now view 3D models using the Open With...
command.
I try to open the viewer but nothing appears. Tried different files, used url, local files ... nothing happen ! Is there something to activate after the installation of this extension ? Thank you for your help
Using : MacOS 10.14.6 VSCode 1.37.1 3DViewer for VSCode 0.1.0