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

npm extension activates in web despite declaring virtualWorkspaces: false #163480

Closed
joyceerhl opened this issue Oct 12, 2022 · 8 comments · Fixed by #168177
Closed

npm extension activates in web despite declaring virtualWorkspaces: false #163480

joyceerhl opened this issue Oct 12, 2022 · 8 comments · Fixed by #168177
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders languages-basic Basic language support issues verified Verification succeeded
Milestone

Comments

@joyceerhl
Copy link
Collaborator

  1. Open https://insiders.vscode.dev/github/microsoft/vscode and trust the workspace
  2. Go to Show Running Extensions from the extensions pane
  3. 🐛 See that npm extension is activated even though it declares virtualWorkspaces: false in its package.json, which should disable it in all virtual workspaces

image

@sandy081
Copy link
Member

Virtual workspace check is only considered in Desktop. In web all extensions those are web enabled are enabled irrespective of virtual workspace.

@sandy081 sandy081 added the *as-designed Described behavior is as designed label Oct 18, 2022
@joyceerhl
Copy link
Collaborator Author

In web all extensions those are web enabled are enabled irrespective of virtual workspace.

Can I ask why this is the case? The npm extension activates eagerly due to workspaceContains:package.json when opening a repository containing a package.json file (e.g. extensions). I don't need this extension and today would need to manually disable it.

@sandy081
Copy link
Member

Virtual workspace support is only for desktop clients. In web all workspaces are virtual.

CC @aeschli

@aeschli
Copy link
Contributor

aeschli commented Oct 21, 2022

@sandy081 is right, and I agree it's a bit confusing.
The npm extension has a browser main entry point where it contributes code completions and hovers for the dependencies in package.json. It uses online services for that, so it also works with virtual workspaces.
That said, it should not say virtualWorkspaces: false but instead just disable the functionality that doesn't work when in a virtual workspace.

@aeschli
Copy link
Contributor

aeschli commented Nov 28, 2022

What do we want to change?

  • that virtualWorkspaces: false is observed in the web
  • that the npm extension does not declare virtualWorkspaces: false ?

@joyceerhl
Copy link
Collaborator Author

I would propose the following changes:

  1. npm extension does not declare virtualWorkspaces: false
  2. Additionally, can we make the npm extension activate less eagerly i.e. not on workspaceContains:package.json? Today the npm extension activates whenever we open a VS Code extension repo for e.g., which seems unnecessary. Maybe we could instead activate when a package.json file is opened? (I don't believe we have an activation event for this but perhaps we could introduce one?)

@aeschli
Copy link
Contributor

aeschli commented Dec 6, 2022

workspaceContains:package.json is currently needed to set the npm:showScriptExplorer context variable that is used to enable/disable the npm explorer. @alexr00

@aeschli aeschli added languages-basic Basic language support issues bug Issue identified by VS Code Team member as probable bug and removed *as-designed Described behavior is as designed labels Dec 6, 2022
@alexr00
Copy link
Member

alexr00 commented Dec 6, 2022

I don't think we have a work around for the npm:showScriptExplorer context value, so we need to keep the activation as is. @meganrogge

@vscodenpa vscodenpa added unreleased Patch has not yet been released in VS Code Insiders insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Dec 6, 2022
@rzhao271 rzhao271 added this to the January 2023 milestone Dec 29, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Jan 20, 2023
@joyceerhl joyceerhl added the verified Verification succeeded label Jan 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders languages-basic Basic language support issues verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants