microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.31k stars 28.9k forks source link

Persisting "disable by workspace" settings in source control #18386

Closed unional closed 9 months ago

unional commented 7 years ago

Can this setting be saved in the workspace setting.json so I don't need to ask every developer to disable the extension (if installed)?

In my company, our main product is stored in perforce so I use the perforce extension. However, there are many small projects stored in git (bitbucket).

Optimally, I would like to "enable by workspace" and "disable by default", but if that is not available, then storing the setting would be the second best option.

Or maybe I should just suggest that feature instead? 🌷

mjbvz commented 7 years ago

I do not think this is currently possible. We allow workspaces to recommend extensions using .vscode/extensions.json, but not disable or enable installed extensions.

@joaomoreno or @sandy081 Any thoughts?

joaomoreno commented 7 years ago

Yup, not possible today. But I definitely see the need.

jcrben commented 7 years ago

I'd also like this. For disable by default, see https://github.com/Microsoft/vscode/issues/15611

esetnik commented 5 years ago

This is also crucial for projects which use tslint not prettier. Most of my JS work is done using prettier but when I open a new javascript project which does not use prettier the extension loads by default and starts formatting everything. Disabling editor.formatOnSave for the workspace is not ideal because it assumes there are no other project formatters in use. It'd be great to be able to configure extension loading (and maybe even default extension settings) on a per-project basis so that one can simply clone a repo and get the correct vscode configuration. One option would be to split settings.json into two files (one which is expected to be committed into the repository and one that allows power users to override settings locally. E.g. settings.json and settings.overrides.json where the order of precedence is:

  1. .vscode/settings.overrides.json <- local workspace overrides not meant to be commmitted
  2. .vscode/settings.json <- defaults for project
  3. user settings <- defaults for vscode user
  4. vscode defaults
sandy081 commented 5 years ago

@esetnik Did you try doing following:

@unional You can fulfil your requirement already now using these steps. Let me know if you still need to store in the workspace and if so why?

esetnik commented 5 years ago

@sandy081 Yes but this should be configurable by some file which I can commit into my repository. Otherwise every dev on my team would have to do the above procedure for each of our projects.

sandy081 commented 5 years ago

@esetnik I think it is hard to know the extensions installed by others. There could be many other extensions each user could have installed. It should be the user choice to disable an extension if it does not work. I also think it is not a general scenario and you can fix it either by communicating to the team or have a custom extension that looks for the extensions you do not want and notify the team.

esetnik commented 5 years ago

@esetnik I think it is hard to know the extensions installed by others. There could be many other extensions each user could have installed. It should be the user choice to disable an extension if it does not work. I also think it is not a general scenario and you can fix it either by communicating to the team or have a custom extension that looks for the extensions you do not want and notify the team.

@sandy081 I believe the extension recommendation system should be used for this purpose. When the user first opens vscode which includes extension requirements they don't have it should inform the user to install those extensions and then reload. My goal is to get to a 100% working vscode setup for any particular project from git clone as quickly as possible. Having mixed extension configuration / installation / loading across team is bad for consistency.

sandy081 commented 5 years ago

@esetnik I agree that extension recommendation should be used to set up a project quickly in VS Code and is doing exactly what you mentioned.

But, I do not agree to have a black list of extensions to uninstall/disable which will remove the extension from user window. IMO this is not a good experience. As said, the list is open ended and it cannot be complete.

Having mixed extension configuration / installation / loading across team is bad for consistency.

Looks like you want to restrict the extensions your team want to use for a project like a strict mode?

bradzacher commented 5 years ago

An example is for projects that use prettier. If a user has the prettier extension installed, then everything is fine - we can use the extension recommendation system to help people discover the prettier extension.

However if the user has already got an extension like beautify, then it causes undefined behaviour in vscode because both extensions implement format on save functionality.

I've run into this problem before - I've setup a project level vscode config which turned on formatOnSave so that people didn't have to manually configure it. However this caused a lot of issues for contributors because many had both prettier and beautify installed, so I had to remove the project level config.

If we had a way to disable user's extensions, then the whole thing could have been avoided.

There are many cases where as a project author/maintainer, I don't want people to use certain extensions. Right now I can only put them in the readme and hope that contributors read it and disable them (hint - they almost never do).

Most people already have their VSCode setup how they like it when they open up a new repository to contribute, so they do not look at the extensions screen. So providing recommendations to have users manually enable/disable extensions is kind of useless in that regard.

Another use case for a feature like this would be to let me disable and enable extensions across computers. Like @esetnik said, I want to be able to get from clone to working as quick as possible. If I've got my vscode setup with many extensions installed, I might want to turn some extensions on/off depending on the type of code in the project. For example if I open a C# project, I want a suite of C# extensions turned on, but I don't want my suite of JavaScript extensions turned on, and vice versa.

If you're really worried about it being abused or people not liking it, you can always add a user setting to vscode which ignores it, so that if someone gets annoyed by a project disabling their extension, they can toggle the setting to ignore workspace configs.

Personally, I don't see how this sort of extension config is any worse than project vscode config. I reckon that I can do a lot more to create a bad user experience for a user by putting random settings in the project vscode config than I can by simply disabling extensions.

JeremyVyska commented 5 years ago

Hiya!

So, working with VSC with Dynamics 365 Business Central, we have to install from VSIX the appropriate version of the Extension do our development work with BC for on-premise customers.

Microsoft currently releases a new version of BC and the VSIX every month. This means that we have to constantly switch out and in a VSIX file for development to match the project. It would be a HUGE help to be able to tie what extensions are enabled/disabled per workspace from the settings.json file, as we could simply install ALL the relevant VSIX versions we are needing, then let the settings.json file that is in our SCM repo for that project drive which version of the Extension we're using.

The existing recommendation and Enabled/Disable per workspace is great, but we very, very much need this functionality in the per-workspace settings.json in our industry use.

sandy081 commented 5 years ago

@bradzacher Nicely summarised.

I like the idea of having workspace specific extension profiles. If a workspace has a profile, opening that in VS Code should run with that list excluding some already installed user extensions. How somebody can define that some extensions as it varies from user to user? It lacks some kind of generalisation. What I do not like is listing extension by extension in that list. May be instead of listing one by one why not the list can be those extensions listed in workspace + installed UI extensions.

On a related note to those who are complaining about multiple formatters, I think it is a different issue and is being tracked here - https://github.com/Microsoft/vscode/issues/41882. I do not want this issue drives this feature.

If everybody agrees that they need workspace extension profiles, I would update the issue accordingly.

robbiespeed commented 5 years ago

@sandy081 I really don't like the idea of a workspace shutting off all extensions it doesn't have listed. Although I do understand a workspace extension exclusion list, would be problematic especially for open source projects, I could foresee a lot of pull requests to add exclusions. Still I like the exclusion list better than a only allow these extensions list.

Another alternative could be a change to extensions themselves, allowing extensions to list other extensions they conflict with. Then based on the workspace's recommended extensions list it turns on all of those, and turns off all extensions that may conflict.

bradzacher commented 5 years ago

My thinking that the feature would at least let us expressly blacklist extensions.

A whitelist could work, but that would imply that a user's extensions are disabled by default and are selectively turned on when you open a project, which seems kind of backwards?

Essentially I want to be able to force disable certain extensions in my project because:

Maybe it would also be good to provide a better way to notify users of recommended extensions for this workspace, because the current one relies on users specifically going into the extensions tab and opening the recommended section (which, like I said, from my experience almost never happens).

robbiespeed commented 5 years ago

I know they don't apply to my current project (i.e. it's a C# project and I don't want JS extensions running).

This is a good point, and even though I didn't like it maybe a whitelist actually is the best option. Otherwise your put in a position where you have to exclude every JS (and non C#) extension one by one. As long as there is an opt-in/opt-out override the user can apply to each workspace.

sandy081 commented 5 years ago

@robbiespeed What are the conflicting extensions?

@bradzacher

*know they cause problems in the project for whatever reason (i.e. disabling beautify because it conflicts with our usage of prettier).

As I mentioned already, this is a different issue and is being tracked here #41882 (Multiple formatters).

Maybe it would also be good to provide a better way to notify users of recommended extensions for this workspace, because the current one relies on users specifically going into the extensions tab and opening the recommended section (which, like I said, from my experience almost never happens).

Also not related to this issue.

I would like to stick to the use case - Open workspace with necessary extensions. Necessary - Workspace recommendations + . It would be great if we can discuss about what this should be?

These other extensions can be only theme extensions? or May be give the decision to the user to choose others?

bradzacher commented 5 years ago

As I mentioned already, this is a different issue and is being tracked here #41882 (Multiple formatters).

Yup, I realise - this was just an example of why someone might want to disable an extension. This is the example that I bring up because it's one that I've directly encountered. I don't install too many extensions myself, but I'm sure that this isn't the only case of extensions conflicting (either with each other, or with the project itself).

Maybe someone has an off-brand eslint extension installed which is pinned to an old version of eslint and breaks in your workspace? Maybe there's some snippet extension that you know provides incorrect snippets because of something in your workspace.

I would like to stick to the use case - Open workspace with necessary extensions. Necessary - Workspace recommendations + . It would be great if we can discuss about what this should be?

These other extensions can be only theme extensions? or May be give the decision to the user to choose others?

I'm not sure I understand your question.

For me the solution is to create a blacklist of extensions by name. This would allow the user to have all their extensions enabled for the workspace except for those that I have listed. This handles the use case where you have extensions that break/conflict with the project - I would see this being used by open source projects because they have an open, unstructured set of users which have their own, individual extension lists.

Others have suggested a whitelist for their usecase, which I assume would work the opposite way: disable all extensions except for those that you have whitelisted. This handles the use case of personal/private/etc projects where you (and your team) have a common set of extensions installed, and you need to switch between them based on the project you're working on. (i.e. you only want your C# extensions enabled for your C# project) You need a whitelist for this because you cannot manually list every single javascript/python/ extension in a blacklist.

In this solution the two lists are mutually exclusive by design - you cannot have both a whitelist and a blacklist simultaneously for a workspace.

sandy081 commented 5 years ago

I understand that having multiple formatters is driving the black list use case but since that issue is being solved separately in a different way, I would wait for the real time scenario for the black list feature instead of guessing someone might need this feature.

I would definitely see the necessity of Project specific extensions (white list).

nsmithdev commented 5 years ago

I would also appreciate a way to blacklist specific extensions inside of specific projects via source control. We have several Angular projects so we all have the (angular.ng-template) extension installed. I'm currently working inside of a React project and noticed that it's running inside of this project and making all the suggestions really slow. Disabling for workspace helps in this instance but I do not have a way to make this happen automatically for the rest of my team. Disabling it in general and enabling per project via white list would be interesting but would require manual steps by all team members to disable by default. The white list only approach also seems interesting but I'm worried could cause confusion or be restrictive in discovering and testing new extensions. In my case we have one specific thing we know causes a problem and we need an easy way to tell everyone's ide to avoid the known problem without being too restrictive.

TriMoon commented 4 years ago

Request renewed #91885

TriMoon commented 4 years ago

@sandy081 what is taking so long to implement the functionality to disable extensions from a workspace config file? You already have the functionality to disable per workspace, you just need to save and load the setting from the workspace config file instead of the internal cache/state or whatever you are using... I honestly DON'T understand why it is being held back for so long...

sandy081 commented 4 years ago

Definitely because of other high priority stuff.

obedm503 commented 4 years ago

@TriMoon you could always submit a PR

TriMoon commented 4 years ago

@obedm503

@TriMoon you could always submit a PR

Sorry but i am already over my ears in aiding other non-profit projects...

AdamJel commented 3 years ago

Hi @sandy081 any update on this?

This seems to be troubling a lot of people (lot of duplicate issues, lots of comments). It also seems, that there is some resistance from vscode developers side - lots of counter-comments disagreeing with the need of code based definition of enabled/disabled extensions, whilst it seems to be the only correct way to treat extensions in the same manner as all ' as a Code' best practises. It is actually a lot unintuitive, that I can not define enabled/disabled extensions in .code-workspace settings.

So, let me ask, just for clarification of vscode-developers point of view: Do we agree, that there is a need for disable-by-default-all-extensions in settings.json AND enable-per-extension in .code-workspace settings? And it is on your to-do list, you just work on more high-priority stuff first?

Thank you for clarification and all the great work on vscode so far.

sandy081 commented 3 years ago

Sorry 😐 , no updates unfortunately.

dantman commented 3 years ago

IMHO bad extensions (like the suggestion of the Angular one slowing down React projects) should be fixed rather than disabled by the workspace.

The linter and formatter issues should be fixed with settings. i.e. A workspace setting declaring what formatter/linter to use or whether it should be enabled.

I am in favor of a way to add workspace settings recommendations to source control.

That solves other issues beyond just disabling a few troublesome extensions:

heartacker commented 3 years ago

I want to disable some extensions in some of my team workspace because those extensions have performance problem(or other issues). I hope that I can add the disable setting to vscode-workspace file to disable for those team mates. just like I can recommend extensions.

and teammates should show a message that settings want to disable those extension? YES/NO. Just like recommend

zeeforum commented 3 years ago

Hi,

I have an idea that is easy to implement for you, I think.

I also faced the issue to enable recommended extensions for my Workspace. I work on different technologies according to which I have to switch to different environment. For that I need to disable and enable some extensions.

The idea is simple.

I think it's simple to implement.

Thank You Regards: Zartash

astrolemonade commented 1 year ago

Hi @sandy081 any update on this?

mayrholu commented 1 year ago

Our company works in an enclosed environment so we provide vscode with several pre-installed extensions to our users. In the case of python we have pylint, flake8 and ruff as possible linters. So far one could just toggle the extensions "python.linting.pylintEnabled": true entry in .vscode/settings.json. With the python extension about to drop linters/formatters and move them to separate extensions this option will no longer be available. Having the enabled/disabled state in a file would really help! SO PLEASE @sandy081 can you give this a higher priority? Thank you!

TriMoon commented 1 year ago

Looking at the age of this issue, with no fix yet, (Jan '17 that's 6½ years back now)

I think it is best to advise that people use a different IDE/Editor instead of this M$ one. It ain't that hard to find good alternatives to this editor. i'm already using a free alternative for years now... :vulcan_salute:

vscodebotnpa commented 9 months ago

We closed this issue because we don't plan to address it in the foreseeable future. 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!

IronGeek commented 8 months ago

And... All it took was 7 years to conclude that this feature is out-of-scope... :face_exhaling:

aranda-adapptor commented 8 months ago

This is a pity. The rise of AI assistant extensions highlights another reason to have this feature. Our company is a consultancy/agency that uses VSCode almost exclusively. We're rolling out the use of Copilot and hence our devs will all have the extension installed and enabled by default. The problem occurs because some clients have explicitly disallowed the use of AI assistants. Without the ability to blacklist the Copilot extension in the workspace, we run the risk of developers forgetting to disable it, and having to remember to disable/enable it when they switch between projects.

I don't agree with the argument that extension blacklisting should not be implemented because "the list is open ended and it cannot be complete". Yes, we cannot guarantee our developers won't be using other disallowed extensions, but we can disable the ones we know we do commonly use. A useful feature shouldn't be ignored just because it isn't perfect.