Closed alefragnani closed 3 years ago
Hi,
It looks like there is an undocumented browser
field in the extension manifest, https://github.com/microsoft/vscode/blob/ee1655a82ebdfd38bf8792088a6602c69f7bbd94/src/vs/platform/extensions/common/extensions.ts#L241
Add it to your package.json, much like the main
field
https://github.com/larshp/vscode-source-map/commit/9d31c30e77dadfd5165787d2a7f504e1d16f3fde#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R26
I managed to install my extension vscode-source-map, tho something doesn't work regarding the contributed action, one step at a time 😁
Also found a LSP web-enabled sample extension = https://github.com/microsoft/vscode-extension-samples/tree/main/lsp-web-extension-sample
We're in the process of updating our extension API doc to show what it needs to allow and extension to run in the web-worker extension host, i.e. right in the browser.
@kieferrm thanks 👍
another note, I found https://github.com/microsoft/vscode-test-web which I guess can help testing for web compatiblity
Requirements for browser compatibility are unclear to me as well. As I see it, the following features cannot be used in browser:
git
or bash
)But what is about, e.g., storing data in a file system cache? Is there already an API, or could VS Code provide one, that allows extensions to read from and write to a cross-workspace cache? For VSC on desktop, this could map to /usr/local/whatever
, but for github.dev, the browser's local storage feature could be utilized.
The guide for web extensions is worked on here: https://github.com/microsoft/vscode-docs/blob/vnext/api/extension-guides/web-extensions.md
Feedback is welcome!
Hi @aeschli ,
Thanks a lot for the documentation. It’s extensive but informative. Contratulations 👏
I didn’t try to update any of my extensions yet, but I read the documentation carefully and looked the updated vscode-extensions-sample repo. I think I understood the idea, but I missed one thing and I think it could be an improvement to the documentation and/or samples repo:
helloworld_regular_and_web_sample
, because the helloworld_web_sample
seems to be a web only extensionwebpack_regular_and_web_sample
, because I use Webpack (as VS Code docs suggests to use in some cases) and because I noticed the Webpack script for Web is a bit different, it would be great to have a all in one sampleAlso, based on this phrase in the publishing section ( ”Web extensions are hosted on the Marketplace along with other extensions.” ), my understanding is that the web version will be a different package. Is that correct, or will vsce
take care of it in a single vsce publish
command?
I also looked at other web ready extensions (mostly from MS/VSCode team) which were already available at launch, and noticed these missing pieces. That’s another reason why I think those samples would help other extension developers to update their extensions.
Thank you
@alefragnani Thanks for the feedback. I restructured the article to give more space for Update existing extensions to Web extensions
where I can spend more words on what to do to make an extension both a node and a web extension.
I try to find a good example of an extension that has a webpack file that contains both web and node that I can link to. Not sure about another sample.
my understanding is that the web version will be a different package
At the moment it's the same package . That means when a user installs an extension on disk, it contains all the bits. That's not ideal and we are working on a solution. But the idea is that vsce publish
will take care of it .
Closing as fixed. The guide will be part of the docs that are published once the August release is out.
Related question - as TypeScript can import
from a JSON file, is it okay to set the main
and browser
manifest fields to ./themes/color-theme.json
for a theme pack?
I've never seen that main
points to a json file.
For extensions we expect this to be a commonjs JavaScript file with exports activate
and optionally deactivate
.
Does this issue occur when all extensions are disabled?: Yes/No
Steps to Reproduce:
.
Copy Word in Cursor
extension from alefragnaniLearn More
linkThanks in advance