-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
How to enable / disable extension from API or commands #15466
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 |
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 |
@richarddavenport Here is the issue you are looking for - #15611 |
@sandy081 that issue only stores the enabling into local storage - #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 |
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. |
As installing and Uninstalling extension gets API interface. 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 ? |
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 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 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. 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 😊 |
I also ran into this problem, you can see how I implemented it in my repository. Initially selected disabled extensions: 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 |
@evald24 Updating |
@evald24 My bad. Your code is working. I just need to restart VSCode so it can reload the updated |
Any updates on this feature? |
is there any way to disable some specific extension through API ?
installExtension
anduninstallExtension
commands were recently added in vscode.The text was updated successfully, but these errors were encountered: