You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+25Lines changed: 25 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -249,6 +249,31 @@ prettier.objectWrap
249
249
prettier.experimentalOperatorPosition
250
250
```
251
251
252
+
#### Language-Specific Formatting
253
+
254
+
All Prettier options above support language-specific overrides. This allows you to set different formatting rules for different file types directly in your VS Code settings, which are easily synchronized across machines and environments.
255
+
256
+
To configure language-specific settings, use the `[language]` syntax in your VS Code `settings.json`:
257
+
258
+
```json
259
+
{
260
+
"[html]": {
261
+
"prettier.printWidth": 180
262
+
},
263
+
"[typescript]": {
264
+
"prettier.printWidth": 120,
265
+
"prettier.tabWidth": 4,
266
+
"prettier.semi": false
267
+
},
268
+
"[json]": {
269
+
"prettier.printWidth": 80,
270
+
"prettier.tabWidth": 2
271
+
}
272
+
}
273
+
```
274
+
275
+
This feature is particularly useful when working in multi-language projects or when different languages have different formatting conventions. Language-specific settings will override the global Prettier settings when formatting files of that language type.
276
+
252
277
### Extension Settings
253
278
254
279
These settings are specific to VS Code and need to be set in the VS Code settings file. See the [documentation](https://code.visualstudio.com/docs/getstarted/settings) for how to do that.
0 commit comments