Extension Activation on web is not fired for each local folder opened
See original GitHub issueDoes this issue occur when all extensions are disabled?: Yes/No
- VS Code Version: web
- OS Version: MacOS Big Sur / MSEdge and Safari
Steps to Reproduce:
Maybe. I’m missing something, but it seems the extension activation in web extensions works a bit different compared to desktop.
I mean, in desktop, the regular activate
function is fired every time a workspace is opened, respecting of course what you defined in activationEvents
. which in my case, is *
yet. In web (http://vscode.dev to be more precise), it seems the extension is activated only once when you navigate to http://vscode.dev. And no matter how many local folders you open, the activate
function is not called anymore.
I’m using the side load approach to test my extension in web, and noticed this behavior because I use workspaceFolders
while in the activation event to manage some data used on my extension. In web, this is returning undefined
, even after I opened some local folder.
I didn’t find any documentation nor any issue that points to this behavior, so I wonder I’m doing something wrong.
On the other hand, I could see the onDidChangeWorkspaceFolders
being fired when you open a different folder, but based on API Docs, this event should be fired only when you add/remove some folder from a workspace.
Also, I’m not sure another issue is being caused by the side load approach (just like debugging extensions does) but the activationEvents
is not being respected on web. I changed my extension to workspaceContains:somefile
and it was activated even on an empty workspace.
Thank you
Issue Analytics
- State:
- Created a year ago
- Comments:17 (9 by maintainers)
Top GitHub Comments
Yeah…as I said, maybe I’m mistaken. In this case, I probably am 😆
To clarify: we only force an empty MR workspace onto you for when you open vscode.dev / insiders.vscode.dev. Once you go to a remote, that changes.
In other words, in web, without a server, the empty window experience is that empty MR workspace where you can open local folders in if the browser supports that. And when you do, immediately the first folder will change and thus most likely restart the extension host.
On desktop, when you open a folder, the window reloads into that folder.
So yeah, there is a difference.