microsoft / vscode

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

Extensions' configuration in .vscode/settings.json using non-unique key names #219719

Closed mbfis closed 1 month ago

mbfis commented 4 months ago

Type: Bug

Hi, It seems there is a mishap in VsCode which allows extensions to be configured through .vscode/settings.json file in such a way that key names for each extension are not prefixed with a unique extension ID, but are rather allowed to be arbitrarily chosen by extension developers.

For example, if you want to configure one of the 2 following extensions (vscode-stylelint and vscode-stylelint-plus) to be enabled, through .vscode/settings.json, and want to disable another (e.g. to force all the devs to use 1st instead of the 2nd extension), you'll find it difficult, because they share exact the same set of key names in settings.json file, probably due to the fact the 2nd is the fork of the 1st.

Both of their respective repository pages contain the same key names for the settings.json file: 1 https://github.com/stylelint/vscode-stylelint 2 https://github.com/hex-ci/vscode-stylelint-plus

Is there a way to configure .vscode/settings.json in such a way that we can enable extension No 1 and disable extension No 2 (key name in that case would be, according to their repo pages - "stylelint.enable")

Cheers

VS Code version: Code 1.90.2 (5437499feb04f7a586f677b155b039bc2b3669eb, 2024-06-18T22:34:26.404Z) OS version: Windows_NT x64 10.0.17763

sandy081 commented 4 months ago

For example, if you want to configure one of the 2 following extensions (vscode-stylelint and vscode-stylelint-plus) to be enabled, through .vscode/settings.json, and want to disable another (e.g. to force all the devs to use 1st instead of the 2nd extension), you'll find it difficult, because they share exact the same set of key names in settings.json file, probably due to the fact the 2nd is the fork of the 1st.

Can you please explain how are you doing this in .vscode/settings.json?

mbfis commented 4 months ago

Can you please explain how are you doing this in .vscode/settings.json?

Well, at the moment, due to this bug, I'm not actually doing it, since I can't.. The key names are the same. For example, my .vscode/settings.json looks similar to this:

{
    "npm.packageManager": "yarn",
    "files.trimFinalNewlines": true,
...
    "html.validate.styles": false,
    "stylelint.enable": true,
    "editor.detectIndentation": false,
...
    "javascript.preferences.quoteStyle": "single",
    "typescript.preferences.quoteStyle": "single",
    "typescript.format.semicolons": "insert",
    "scss.lint.zeroUnits": "error"
}

Please note the "stylelint.enable": true, part. Which of those 2 extensions does it enable?

vs-code-engineering[bot] commented 1 month ago

Hey @rzhao271 @sandy081, this issue might need further attention.

@mbfis, you can help us out by closing this issue if the problem no longer exists, or adding more information.

sandy081 commented 1 month ago

@mbfis Have you tried disabling the extension from the extensions view?

vs-code-engineering[bot] commented 1 month ago

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!