Skip to content
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

Default language settings override multiple language ones #206460

Closed
memeplex opened this issue Feb 28, 2024 · 11 comments
Closed

Default language settings override multiple language ones #206460

memeplex opened this issue Feb 28, 2024 · 11 comments
Assignees
Labels
config VS Code configuration, set up issues *duplicate Issue identified as a duplicate of another issue(s) info-needed Issue requires more information from poster

Comments

@memeplex
Copy link

  • VS Code Version: 1.86.2
  • OS Version: macOS Sonoma

Default language specific settings override explicit multiple language settings.

For example:

  "[markdown][typst]": {
    "editor.wordWrap": "bounded",
    "editor.tabSize": 4,
    "editor.lineNumbers": "off",
    "editor.rulers": [],
  },
  • The two last options are set for both modes
  • tabSize only for markdown
  • wordWrap for none of them

At least regarding wordWrap I know it's set as a language default. Moreover, after separately setting the same options for both languages, all of them are correctly configured.

I don't think this behavior is convenient or intuitive. Explicitly set options, even if they are for a union of languages, should override implicit default ones.

@memeplex
Copy link
Author

memeplex commented Feb 29, 2024

I don't think this behavior is convenient or intuitive

According to https://code.visualstudio.com/docs/getstarted/settings#_settings-precedence it's indeed a bug:

In the following list, later scopes override earlier scopes:
...
Language-specific default settings - These are language-specific default values that can be contributed by extensions.

Language-specific user settings - Same as User settings, but specific to a language.

There is no distinction between single/multi language setting.

Later in the doc:

"[typescript][javascript]" workspace setting will not override a "[javascript]" user setting.

I guess the logic for single-overrides-multi is not making this distinction:

  • user-single > user-multi
  • lang-single < user-multi

@sandy081
Copy link
Member

sandy081 commented Mar 4, 2024

I am not sure if I understood the issue. Can you please be crisp and clear about the issue?

@sandy081 sandy081 added the info-needed Issue requires more information from poster label Mar 4, 2024
@memeplex
Copy link
Author

memeplex commented Mar 4, 2024

TBH I'm not sure about what do you expect since I've already given a concrete example, some links to points where the documentation contradicts what's observed and an analysis of what may be the cause, so at the risk of repeating myself consider the following scenarios:

  1. The user sets some option opt for a specific language lang1: "[lang1]": ....
  2. The user sets opt for lang1 and some other language: "[lang1,lang2]": ...
  3. An extension sets a default value for opt in lang1

Currently 1 will override 2 and 3 as expected, but 3 will override 2. This is arguably wrong and doesn't follow the documented behavior as I mentioned before:

According to https://code.visualstudio.com/docs/getstarted/settings#_settings-precedence

In the following list, later scopes override earlier scopes:
...

  • Language-specific default settings - These are language-specific default values that can be contributed by extensions.
  • Language-specific user settings - Same as User settings, but specific to a language.

@sandy081
Copy link
Member

sandy081 commented Mar 7, 2024

Currently 1 will override 2 and 3 as expected, but 3 will override 2.

This seems to be contradicting your statement. If one overrides 2 and 3 and how 3 can override 2? Hence, I am asking for repro steps

@memeplex
Copy link
Author

memeplex commented Mar 7, 2024

I don't see the problem, 1 overrides 3 overrides 2, so 1 overrides both of them.

@sandy081
Copy link
Member

sandy081 commented Mar 7, 2024

I don't see the problem

Then what is the problem? To get rid of confusion, please provide clear steps to reproduce with a concrete example and what is current behaviour and what do you expect?

@memeplex
Copy link
Author

memeplex commented Mar 7, 2024

I've thoroughly explained everything. The problem is in 3 overrides 2, of course. As I've defined:

  1. The user sets opt for lang1 and some other language: "[lang1,lang2]": ...
  2. An extension sets a default value for opt in lang1

I'm going to spell "3 overrides 2": A default value set by an extension for a language overrides a value set by the user for the same language (alongside another language, as in [lang1,lang2]).

But, for the third time, the documentation states:

In the following list, later scopes override earlier scopes:
...
Language-specific default settings - These are language-specific default values that can be contributed by extensions.
Language-specific user settings - Same as User settings, but specific to a language.

If you don't see the contradiction in that, then I don't have anything else to add.

@sandy081
Copy link
Member

I'm going to spell "3 overrides 2": A default value set by an extension for a language overrides a value set by the user for the same language (alongside another language, as in [lang1,lang2]).

This should not happen, if an extension contributes default value for a language and user also defines a value for the same language, then user value should be taken. If this is not happening, I would request to provide proper step by step set up for me to reproduce. Giving steps will help both of us to be on same page.

@memeplex
Copy link
Author

I've provided an example in the opening post, but then again:

  1. Put this into your settings:
  "[markdown][latex]": {
    "editor.wordWrap": "bounded",
  },
  1. Create and open a markdown file

  2. See how wordWrap is not bounded

  3. Change the settings to:

  "[markdown]": {
    "editor.wordWrap": "bounded",
  },
  1. See how wordWrap is now bounded

@sandy081 sandy081 added the config VS Code configuration, set up issues label Mar 15, 2024
@sandy081
Copy link
Member

/duplicate

#168411

Thanks, this is helpful. Now I understand that settings of single language in default settings is overriding settings of multi language in user settings.

@vscodenpa vscodenpa added the *duplicate Issue identified as a duplicate of another issue(s) label Mar 15, 2024
@vscodenpa
Copy link

Thanks for creating this issue! We figured it's covering the same as another one we already have. Thus, we closed this one as a duplicate. You can search for similar existing issues. See also our issue reporting guidelines.

Happy Coding!

@vscodenpa vscodenpa closed this as not planned Won't fix, can't repro, duplicate, stale Mar 15, 2024
@microsoft microsoft locked and limited conversation to collaborators Jun 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
config VS Code configuration, set up issues *duplicate Issue identified as a duplicate of another issue(s) info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

4 participants