Visual Studio Code (VSCode) is a popular code editor known for its customizability. This customizability is mainly due to the settings.json file, where we can configure the editor to our preferences.
Table of Content
The settings.json file in Visual Studio Code (VS Code) plays a crucial role in customizing the code editor to fit individual needs. We can tailor VS Code to enhance our coding experience. In this article, we will learn about the VSCode settings.json file and customize it for our specific needs.
Understanding VS Code Configuration:
VS Code offers two ways to configure settings:
- User Settings: These apply globally across all the projects.
- Workspace Settings: These are specific to a project and override user settings.
{
// User settings example
"editor.fontSize": 14, // Sets the font size for the editor
"editor.lineNumbers": "on" // Displays line numbers in the editor
}Locating settings.json:
To find the settings.json file:
Method 1: Open VSCode, go to File > Preferences > Settings. Then, click on the icon in the top right corner that looks like a document with an arrow.
Method 2: Use the keyboard shortcut:
- Windows/Linux: Ctrl+,
- macOS: Cmd+,
Modifying settings.json:
Once the file is located, the JSON content can be directly edited. We can customize a wide range of settings in the settings.json file.
Below are some common modification options:
- Editor Settings: Font size, line height, font family, and syntax highlighting.
- File Management: Auto-save options, trimming trailing whitespace, and file encoding.
- Extensions: Custom configurations for installed extensions.
- UI Customization: Sidebar visibility, status bar settings, and layout.
Modifying auto save:
Here we first modify the files.autoSave settings by enabling the auto save after some delay (default 1000ms) and then set the delay to 100 ms.
Outputs:

Modifying tab size
Here, we first modify the indentSize settings from tabsize to 2 and then 4. This line sets the tab size to 4 spaces. We can change the number to any value we prefer, such as 2, 4, 8, etc., depending on our coding preference.

Best Practices:
Use comments to explain the settings: Although JSON doesn’t natively support comments, but we can use descriptive keys or maintain a separate documentation file.
Be cautious when modifying settings: Incorrect values can lead to unexpected behavior.
Consider using a settings.json extension for validation and autocompletion: Extensions like JSON Editor can help in managing the settings.
{
// Use descriptive keys if JSON comments are not supported
"editor.fontFamily": "Fira Code", // Sets the font family for the editor
"files.trimTrailingWhitespace": true // Automatically trims trailing whitespace
}Note: VSCode offers a GUI for modifying common settings, but the settings.json file provides more granular control.
Conclusion:
In conclusion, the settings.json file in Visual Studio Code (VSCode) plays a crucial role in customizing the code editor to fit our individual needs. By understanding the difference between user and workspace settings, and knowing how to locate and modify the settings.json file, we can tailor VSCode to enhance our coding experience. Whether adjusting editor settings, managing files, or configuring extensions, the ability to fine-tune these aspects ensures a more efficient and personalized workflow. Following best practices like using descriptive keys and being cautious with modifications can prevent issues and make our configurations more manageable.
Q1. Why isn't my settings.json change taking effect?
Ans. Make sure to save the file and that the setting isn't overridden by a workspace setting.
Q2. Where can I find a list of all available settings?
Ans. VSCode's documentation provides a comprehensive list.