Vscode: How to enable / disable extension from API or commands

Created on 14 Nov 2016  路  18Comments  路  Source: microsoft/vscode

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

installExtension and uninstallExtension commands were recently added in vscode.

*out-of-scope api extensions feature-request

Most helpful comment

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.

All 18 comments

what is your scenario?

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 : https://github.com/shanalikhan/code-settings-sync/issues/143

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.

I agree with @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.

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.

@richarddavenport Here is the issue you are looking for - #15611

@sandy081 that issue only stores the enabling into local storage - https://github.com/Microsoft/vscode/issues/18386 gets it all the way so that it is persisted into version control - otherwise if we end up pulling down the project again on a new machine we still run into the issue @richarddavenport mentioned of tediously having to enable extensions

@jcrben Yes project based extension profiles is different to #15611

Any updates on adding the ability to disable extensions through the API?

I believe it would be a valuable addition to the API. It would make useful extension management extensions possible, making configuring per workspace extensions more efficient.

https://github.com/microsoft/vscode/issues/73309

As installing and Uninstalling extension gets API interface.
We need similar API command to disable or enable the certain extension?

Settings Sync needs enable/disable the extension based on workspace settings.

This would be huge with setting sync. Then you can disable all secondary languages and tools that are not used daily. Then combined with the option to enable extensions per workspace... You can keep the editor lean for daily use. And well targeted use.

YES it would be amazing if this feature was added. I code in Python for work and in JS for my hobby and personal projects. It would be excellent if I was able to disable ALL my Vue and other JS extensions for my Python projects and all my Python extensions for my JS projects. This would SIGNIFICANTLY make the experience leaner and smoother overall. I really like this idea

@sandy081 is there any update on this ?
As installextension and uninstallextension commands were being added in last vscode releases.

No plans but a command similar to install extension can be thought of.

sure, looking forward.

I'd like to see this. My use case is to disable the built-in PHP Language Features when using https://marketplace.visualstudio.com/items?itemName=bmewburn.vscode-intelephense-client

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.

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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NikosEfthias picture NikosEfthias  路  3Comments

omidgolparvar picture omidgolparvar  路  3Comments

shanalikhan picture shanalikhan  路  3Comments

trstringer picture trstringer  路  3Comments

philipgiuliani picture philipgiuliani  路  3Comments