microsoft / vscode

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

local language specific setting priority is lower than user level language specific setting #168411

Open tjx666 opened 1 year ago

tjx666 commented 1 year ago

reproduce:

  1. install esbenp.prettier-vscode
  2. add following settings to .vscode/settings.json
    
    "[javascript][javascriptreact][typescript][typescriptreact][vue][json][jsonc][html][css][less][markdown][xml][yaml][svg]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    }
3. add following settings to `~/Library/Application Support/Code/User/settings.json`

```json
    "[javascript]": {
        "editor.defaultFormatter": null
    },
  1. open a js file, try to format it, will warning:

image

Version: 1.74.0 (Universal)
Commit: 5235c6bb189b60b01b1f49062f4ffa42384f8c91
Date: 2022-12-05T16:43:37.594Z
Electron: 19.1.8
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Darwin x64 22.1.0
Sandboxed: No
tjx666 commented 1 year ago

@sandy081 I thnk this is a bug not a feature request

SrTobi commented 1 year ago

Observed this bug as well. It's very annoying when the workspace sets a different formatter and then that is not picked up

SrTobi commented 1 year ago

this seems also more complicated... when I do a single "[typescript]" next to the multi-language section it works

workspace settings:

{
  "[javascript][javascriptreact][typescript][typescriptreact][vue][json][jsonc][html][css][less][markdown][xml][yaml][svg]": {
      "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  // with this it works, if something else is set for `[typescript]` in the user settings
  "[typescript]": {
      "editor.defaultFormatter": "esbenp.prettier-vscode"
  }
}

so it seems order is one-language section in workspace > one-language section in user settings > multi-language section in workspace

ulugbekna commented 1 year ago

@sandy081 this is indeed a bug, not a feature request, AFAICT

I also described the bug in #188679

rotu commented 5 months ago

Tripped across this as well. What an annoying bug!