How to open settings.json file in vscode ?


👤 Diwas Poudel    🕒 23 Feb 2023    📁 TECH

Someone suggested that you open the settings.json file in vs code and add these and those properties to it. Then you will do a web search, which may lead you to this site. Today, Ourtechroom will explain in detail Where to Find Settings.json and How to Open Settings.js in vscode.

Settings.json

Settings.json is a crucial file in the vscode editor that is used to customize the user interface and functional functionality vscode reads and applies the settings and configuration from this file, which is in JSON format with key-value pairs.

If you make changes to the settings.json file, vs code may need to be restarted for the changes to take effect. These are the global settings for VS Code.

These files have a JSON extension, and JSON files are commonly used to configure vscode settings since they are familiar with many languages and developers, and the JSON structure is straightforward to comprehend.

How to Open Settings.json File?

There are various ways to open the Settings.json file and we will discuss each of Them.

Method 1: Using GUI (Graphic User Interface)

The GUI version of the vscode code settings is simple to use. To utilize these settings, you don't need any prior understanding of the JSON format.

Steps:

1 Press Below keyboard combination

  • Windows and Linux Press Ctrl + Shift + P 
  • Mac: + Shift + P

 This will open search fields.

2 Type settings.json in the search field. This will show two options. Just select Open Settings(JSON)

settings json file
fig. Open user settings using Shortcut and Search

This will open the settings.json file, which you may update and save to reflect your changes.

Method 2: Using GUI (Graphic User Interface)

The steps are as follows

1 Open VSCode editor

2 Click on Gear Icon located at the bottom left corner.

3 Then Click on Settings.

4 Click on File like icon located at the top right corner.

open-settings-json-file
fig. Open settings.json using Gear Option VSCode

This will open the settings.json file.

Method 3: Using File Explorer

The default location for user settings of vscode are as follows:

In Windows 👇

%userprofile%\AppData\Roaming\Code\User

In macOS 👇

 $HOME/Library/Application Support/Code/User

In Linux 👇

$HOME/.config/Code/User

Simply navigate to these paths according to your operating system. Then, look for the settings.json file. Simply open that JSON file in any text editor and make the necessary modifications and save the file.

Method 4: Using command line

Here are the steps:

1. Open command prompt or terminal
2. Go to the settings.json subfolder. cd path/to/project/folder will take you to the project folder if the file is in the.vscode subfolder.
3. Type the following command and press Enter.

code settings.json

This will open settings.json file in vscode.

Error opening settings.json file in vscode

If you get the error while opening settings.json file in vscode then you can try the following:

  1. Check the settings.json file path. Double-check spelling and file location.
  2. Make sure you can view the settings.json file. VSCode may need administrative privileges if the file is protected or needs elevated permissions.
  3. Make sure VSCode is loaded properly and up to date. Incomplete or damaged VSCode installations may require reinstallation.
  4. Reset VSCode settings: If the problem remains, reset VSCode to its default settings. Open the Command Palette in VSCode by hitting Ctrl+Shift+P (Windows) or Cmd+Shift+P (Mac), type "Preferences: Open User Settings," and press Enter. Click "..." in the top-right corner of the settings window and pick "Reset Settings" from the dropdown menu. Resets VSCode settings to normal.

We discussed user settings in all four methods. settings.json, which is a global setting that applies to all of your VSCode projects.If you want project-specific or workspace configurations, please see the following:

WorkSpace Settings VS Code

Suppose you have a different project and you do not want to use all settings under settings.json then you can override this setting with WorkSpace Settings. When you want to share project-specific settings with your team, workspace settings come in handy. Workspace settings are applied to those folders and projects which are within the workspace. These settings files are located at the same level as your Projects Folder. 
You can also have multiple root folders in a VS Code workspace using a feature called Multi-root workspaces.

WorkSpace Projects can be saved as your wish as you like. 

Workspace Settings filename looks like this: .code-workspace  and you can save it as where you like.And its settings look like this:

{
  "folders": [
    {
    "path": "D:\\Ourtechroom\\Data"
    },
    {
    "path": "D:\\Ourtechroom\\API"
    }
  ]
}
Note: Workspace settings have the ability to override user settings.

Open WorkSpace Setting Using GUI in vs code

Steps to open Workspace Settings using GUI are as follows:

1 First, open your desired Workspace.

2 Then Right-click on File > Preference > Settings 

3 Navigate to Workspace tab

4 Then make changes on these settings that will apply to your current workspace.

workspace-settings
fig. Workspace settings

 

Folder Settings vs code

When you create a workspace, you will have many project folders, and each project folder can have settings.json. You can create a settings.json file inside your projects folder.

Its location will be in : /.vscode/settings.json

Open Folder Settings vs code

The steps are as follows:

1 First, open your desired Workspace.

2 Then Right-click on File > Preference > Settings 

3 Navigate to your Project Folder tab

4 Then make changes on these settings that will apply to your current project only.

Note: Workspace settings are overridden by project folders.

As a result, we discovered that settings in User Settings are overridden by Workspace settings, which are then overridden by Folder settings.

Conclusion:

In this way, we can open and view the different levels of settings like user settings, workspace settings, and projects settings in vscode.