Skip to content

How to enable / disable extension from API or commands #15466

Closed

Description

is there any way to disable some specific extension through API ?

installExtension and uninstallExtension commands were recently added in vscode.

Activity

  1. ramya-rao-a commented on Nov 15, 2016

    @ramya-rao-a
    Contributor

    what is your scenario?

  2. added
    extensions
    *question
    on Nov 15, 2016
  3. shanalikhan commented on Nov 15, 2016

    @shanalikhan
    Author

    Settings Sync needs this. If one extension is installed in one code, it installs on second code instance on work PC.

    But when user disables the extension and make a backup and when it downloads the extension it enables that extension, i need to disable it from API

    Ref : shanalikhan/code-settings-sync#143

  4. MartinSGill commented on Nov 16, 2016

    @MartinSGill

    Isn't it a bit more involved than that?

    When syncing extensions you need to know every extension that's installed (regardless of disabled or not) then you need to also somehow get information on which extension is disabled for which workspace.

    That way you can also sync the workspace settings, essentially providing a backup, it might even be possible to share the workspace settings across installs, e.g. if two copies of a workspace are on exactly the same path on both computers.

    Just my initial thoughts on how I'd expect the sync to work.

  5. sandy081 commented on Nov 16, 2016

    @sandy081
    Member

    I agree with Martin Gill (@MartinSGill) with the approach. While syncing you should be able to have the information about installed, enabled, disabled extensions. This would lead to the issue of how we store some state/settings which we are doing in Local storage. It would be helpful if we are able to share this too.

  6. added
    feature-request
    and removed
    *question
    on Apr 7, 2017
  7. changed the title [-]How to disable extension from API[/-] [+]How to enable / disable extension from API[/+] on May 29, 2017
  8. richarddavenport commented on Sep 25, 2017

    @richarddavenport

    Does anyone have any updates on how we can achieve this? I have sooo many extensions installed because I work on multiple types of projects. I can always disable them for a certain workspace, but every time I pull down a new project I have to go through the tedious process of disabling multiple extensions. For example I have plenty of angular extensions and plenty of vue.js extensions, I have typescript extensions, redux extensions, extensions for c#, python, powershell, prettier/beautify, snippets, and on and on it goes.

    We need a better way to manage this. If there was a way to put an extensions manifest file of some kind in the .vscode folder, then this would solve all of my problems. The next time I load up a project/workspace, then the file could enable and/or disable the extensions. This would be good because I work on a team with multiple people. The next time someone adds or removes an extension then we will all get that update. It helps with code/workspace uniformity. Also onboarding would be simplified too. I know a recommended extensions thing exists, but that honestly doesn't help at all when really we need it to automatically install/uninstall/enable/disable extensions.

  9. 9 remaining items

  10. shanalikhan commented on Jul 2, 2019

    @shanalikhan
    Author

    sure, looking forward.

  11. changed the title [-]How to enable / disable extension from API[/-] [+]How to enable / disable extension from API or commands[/+] on Jul 3, 2019
  12. bmewburn commented on Jul 4, 2019

    @bmewburn
  13. alexeychikk commented on May 17, 2020

    @alexeychikk

    Also it would be great to have the API to list disabled extensions, because right now vscode.extensions.all returns only enabled and built-in extensions.

    I made an extension to create and switch between extension presets in different workspaces. The only last thing I need is to be able to actually enable/disable extensions through the API and the ability to list disabled/enabled extensions.

  14. added
    *out-of-scope
    on Nov 9, 2020
  15. vscode-triage-bot commented on Nov 9, 2020

    @vscode-triage-bot

    We closed this issue because we don't plan to address it in the foreseeable future. You can find more detailed information about our decision-making process here. If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider.

    If you wonder what we are up to, please see our roadmap and issue reporting guidelines.

    Thanks for your understanding and happy coding!

  16. evald24 commented on Jun 19, 2021

    @evald24

    I wrote a plugin that allows you to quickly apply the necessary extensions to the project on pre-prepared profiles.

    The essence is very simple, you create a profile, select extensions and apply the profile.

    Even after restarting VSCode, extensions remain assigned to projects.

    Demo

    The extension is already available on the marketplace

    Who is interested here is the repository

    PS: This is my first extension 🚀, if someone likes it, thank me with a star in the repository or rate me on the marketplace 😊

  17. evald24 commented on Jun 19, 2021

    @evald24

    Also it would be great to have the API to list disabled extensions, because right now vscode.extensions.all returns only enabled and built-in extensions.

    I made an extension to create and switch between extension presets in different workspaces. The only last thing I need is to be able to actually enable/disable extensions through the API and the ability to list disabled/enabled extensions.

    I also ran into this problem, you can see how I implemented it in my repository.

    Initially selected disabled extensions:
    The list of globally disabled extensions I found in
    ${process.env.HOME}/Library/Application Support/Code/User/globalStorage/state.vscdb field extensionsIdentifiers/disabled But here it shows extensions that are disabled globally.

    Initially selected the enabled extensions:

    export function getEnabledExtensions() {
      return  vscode.extensions.all
        .filter((e) =>  !/.*(?:\\\\|\/)resources(?:\\\\|\/)app(?:\\\\|\/)extensions(?:\\\\|\/).*/i.test(e.extensionPath)) // ignore internal extensions
        .map(item =>({
          id: item.id,
          uuid: item?.packageJSON.uuid,
          label: item?.packageJSON.displayName,
          description: item?.packageJSON.description
        }) as ExtensionValue);
    }

    But it was inconvenient and wrong, and I started scanning the extensions folder, excluding the unnecessary folders listed in .obsolete

  18. daiyam commented on Jul 29, 2021

    @daiyam
    Contributor

    Evald Smalyakov (@evald24) Updating User/globalStorage/state.vscdb isn't working (the db is updated but the extensions...). Maybe it's working for workspace which your code seems to only do, but I've not tested that.

  19. daiyam commented on Aug 24, 2021

    @daiyam
    Contributor

    Evald Smalyakov (@evald24) My bad. Your code is working. I just need to restart VSCode so it can reload the updated state.vscdb.

  20. kosude commented on May 4, 2024

    @kosude

    Any updates on this feature?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

*out-of-scopeapiextensionsfeature-request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions