17

I want to enable word wrap only for specific file types, for example for .tex and .txt files. In my settings.json, I've added the following lines:

"[latex]": {
    "editor.wordWrap": "on"
},
"[plaintext]": {
    "editor.wordWrap": "on"
}

Is there a way to combine these two options into one to avoid duplication?

cbrnr
  • 371

2 Answers2

6

As of version 1.63, this is now possible as follows:

"[plaintext][latex]": {
    "editor.wordWrap": "on"
}

https://code.visualstudio.com/updates/v1_63#_multiple-language-specific-editor-settings

cbrnr
  • 371
  • just tried this in a local settings.json file and it did not work "[typescript][css]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, – Andreas Riedmüller Dec 07 '23 at 15:50
1

Old question, but I was just looking into this and an answer here would have saved me some time.

Your approach is the correct one, and is the only option other than specifying word wrap globally. To answer your question directly, there is no way to combine them. In fact, this is how language-specific settings are specified in VS Code's default configuration.