Join the AI Workshop and learn to build real-world apps with AI. A hands-on, practical program to level up your skills.
Different languages have different conventions for indentation and formatting. VS Code lets you configure settings per language.
Setting Up Language-Specific Settings
Open VS Code preferences (Cmd+,) and add language-specific settings using this format:
"[language-id]": {
"setting.name": value
}
Example: Different Tab Sizes per Language
Here’s an example configuration with different settings for JavaScript, CSS, HTML, and Go:
{
"[javascript]": {
"editor.insertSpaces": true,
"editor.tabSize": 2
},
"[css]": {
"editor.insertSpaces": true,
"editor.tabSize": 2
},
"[html]": {
"editor.insertSpaces": true,
"editor.tabSize": 4
},
"[go]": {
"editor.insertSpaces": false,
"editor.tabSize": 8
}
}
In this example:
- JavaScript and CSS use 2 spaces.
- HTML uses 4 spaces.
- Go uses tabs with a width of 8 (following Go conventions).
Markdown-Specific Settings
When writing Markdown, you might want to disable autocomplete popups:
{
"[markdown]": {
"editor.renderWhitespace": "all",
"editor.acceptSuggestionOnEnter": "off",
"editor.parameterHints.enabled": false,
"editor.quickSuggestions": false,
"editor.snippetSuggestions": "none"
}
}
This disables all the IntelliSense features that can be distracting when writing prose rather than code.
Other Useful Language Settings
You can override any editor setting per language, including:
editor.defaultFormatter- which formatter to useeditor.formatOnSave- enable/disable format on saveeditor.wordWrap- line wrapping behavioreditor.rulers- column guides