Vscode: Multiple languages specific editor settings

Created on 14 Jun 2018  路  13Comments  路  Source: microsoft/vscode

We definitely need the ability to set those for multiple languages at once.

Something like:

// Once for all
"[cpp, c]":{
    "editor.formatOnSave": true
}

Instead of:

// Once for C++
"[cpp]":{
    "editor.formatOnSave": true
},

// And once for C
"[c]":{
    "editor.formatOnSave": true
}
config feature-request

Most helpful comment

Would love this feature, tons of duplicated settings in my settings file and this feature would clean it up quite nicely and reduce copy/pasta accidents.

All 13 comments

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

really want it! we are using something like [json,jsonc,yaml] which is really hard to maintain

I would like this as well but should the logic around having a duplicate setting for the same language? Should there be a hierarchy, ie having the settings pull from the single language specification over the multiple language specifications?

E.g. get settings for _javascriptreact_ from [javascriptreact] over [javascript, javascriptreact]?

"[javascript, javascriptreact]": {
    "editor.insertSpaces": true
},
"[javascriptreact]": {
    "editor.insertSpaces": true
}

Any news? This feature would be very nice to have!

Yup, also want this. Currently it's just a bit of a pain.

{
  "[yaml]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode",
  },
  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode",
  },
  "[javascriptreact]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode",
  },
  "[typescript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode",
  },
  "[typescriptreact]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode",
  },
}

Would love this feature, tons of duplicated settings in my settings file and this feature would clean it up quite nicely and reduce copy/pasta accidents.

Also adding my +1 for this 馃憤

Looks like it's "On Deck" for consideration for an upcoming release so that's good news!

Please just emoji 馃憤 the original post at the top, that way your demand is expressed without notifying everyone who is subscribed for updates

Would be nice for a simple rule to not be this long

 "[javascript]": {
  "editor.codeActionsOnSave": {
   "source.fixAll.eslint": true
  }
 },
 "[javascriptreact]": {
  "editor.codeActionsOnSave": {
   "source.fixAll.eslint": true
  }
 },
 "[typescript]": {
  "editor.codeActionsOnSave": {
   "source.fixAll.eslint": true
  }
 },
 "[typescriptreact]": {
  "editor.codeActionsOnSave": {
   "source.fixAll.eslint": true
  }
 },

Gotta add my +1 for this! 馃帀

I would like this as well but should the logic around having a duplicate setting for the same language? Should there be a hierarchy, ie having the settings pull from the single language specification over the multiple language specifications?

E.g. get settings for _javascriptreact_ from [javascriptreact] over [javascript, javascriptreact]?

"[javascript, javascriptreact]": {
    "editor.insertSpaces": true
},
"[javascriptreact]": {
    "editor.insertSpaces": true
}

Should the second entry in this example be treated as a duplicate object key?

@igetgames

Rather than duplicate object key, perhaps if there are duplicate settings for the same language then a warning message could appear.

In the code example above:

"[javascript, javascriptreact]": {
    "editor.insertSpaces": true
},
"[javascriptreact]": {
    "editor.insertSpaces": true
}

A warning message could appear along the lines of:

The setting editor.insertSpaces is configured multiple times, in: [javascript, javascriptreact] and [javascriptreact]

Was this page helpful?
0 / 5 - 0 ratings