Skip to content

Commit 7656924

Browse files
Copilotntotten
andauthored
[WIP] Fix issue with file types in settings.json (#3915)
* Initial plan * Add test fixture for multi-language settings investigation Co-authored-by: ntotten <282782+ntotten@users.noreply.github.com> * Document VS Code limitation with combined language settings for editor.defaultFormatter Co-authored-by: ntotten <282782+ntotten@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ntotten <282782+ntotten@users.noreply.github.com>
1 parent 4c4a652 commit 7656924

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,27 @@ To ensure that this extension is used over other extensions you may have install
7979
}
8080
```
8181

82+
**Note:** VS Code does not support combined language syntax for `editor.defaultFormatter`. You must set the formatter for each language separately:
83+
84+
```json
85+
// ❌ This will NOT work
86+
{
87+
"[javascript][typescript]": {
88+
"editor.defaultFormatter": "esbenp.prettier-vscode"
89+
}
90+
}
91+
92+
// ✅ Use separate blocks instead
93+
{
94+
"[javascript]": {
95+
"editor.defaultFormatter": "esbenp.prettier-vscode"
96+
},
97+
"[typescript]": {
98+
"editor.defaultFormatter": "esbenp.prettier-vscode"
99+
}
100+
}
101+
```
102+
82103
If you want to disable Prettier on a particular language you can either create a `.prettierignore` file or you can use VS Code's `editor.defaultFormatter` settings.
83104

84105
The following will use Prettier for all languages except Javascript.

docs/troubleshooting.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,35 @@ Or add to your `settings.json`:
3131
}
3232
```
3333

34+
### Combined Language Settings Not Working
35+
36+
**Note:** VS Code does **NOT** support combined language settings for `editor.defaultFormatter`. While VS Code 1.63+ supports combining multiple languages for some settings using syntax like `[javascript][typescript]`, this feature does not work for the `editor.defaultFormatter` setting.
37+
38+
**This will NOT work:**
39+
40+
```json
41+
{
42+
"[markdown][yaml]": {
43+
"editor.defaultFormatter": "esbenp.prettier-vscode"
44+
}
45+
}
46+
```
47+
48+
**Instead, use separate language blocks:**
49+
50+
```json
51+
{
52+
"[markdown]": {
53+
"editor.defaultFormatter": "esbenp.prettier-vscode"
54+
},
55+
"[yaml]": {
56+
"editor.defaultFormatter": "esbenp.prettier-vscode"
57+
}
58+
}
59+
```
60+
61+
This is a VS Code core limitation, not an issue with the Prettier extension. The combined syntax works for other editor settings (like `editor.wordWrap`, `editor.tabSize`, etc.) but not for `editor.defaultFormatter`.
62+
3463
### Check for Errors in the Output Panel
3564

3665
1. Click "Prettier" in the VS Code status bar (bottom right)

0 commit comments

Comments
 (0)