Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS Code: How to open settings.json file?

I did it many times, and each time I forgot where it was.

Menu FilePreferencesSettings.

I get this:

Enter image description here

I want to open file settings.json (editable JSON file) instead. How can I do that?

like image 497
Kasheftin Avatar asked Jan 26 '21 20:01

Kasheftin


People also ask

Where are Vscode settings stored?

Settings File Locations The workspace settings file is located under the . vscode folder in your project.

What is VSCode settings JSON file?

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.

How do I open a JSON file in Visual Studio Code?

This is the fastest way to open settings.json file in Visual Studio Code. Press Ctrl + , ( comma) on Windows, or... Press ⌘ + , ( comma) on Mac. Or... Next, on the User Settings screen, click on a small button that looks like a new file icon in upper right corner of the VSCode dashboard:

Why does vs code open as JSON file instead of Ui?

As mentioned @Juraj Kocan in comments, it happens after last VS Code updates. Show activity on this post. after making this change, VS Code will open its settings as a JSON file, like in older versions of the application, rather than in the new UI.

How do I Reset my JSON settings in VS Code?

Open the settings.jsonfile with the Preferences: Open Settings (JSON)command and you should see the error highlighted with red squiggles. How can I reset my user settings? The easiest way to reset VS Code back to the default settings is to clear your user settings.jsonfile.


3 Answers

To open the User settings:

  • Open the command palette (either with F1 or Ctrl+Shift+P)
  • Type "open settings"
  • You are presented with a few options¹, choose Open User Settings (JSON)

This image was taken in the VS Code online editor The dropdown list seen of the "open settings" options

Which, from the manual and depending on platform, is one of:

  • Windows %APPDATA%\Code\User\settings.json²
  • macOS $HOME/Library/Application\ Support/Code/User/settings.json
  • Linux $HOME/.config/Code/User/settings.json

The Workspace settings will be in a {workspaceName}.code-workspace file where you saved it, and the Folder settings will be in a .vscode folder if and when it has been created.


Official page on User and Workspace Settings

As stated by sevencardz below, VS Code includes a button in the Settings UI gutter which can be used to switch between JSON and graphical view.

The location of the settings UI/JSON toggle in the top-right corner

The workbench.settings.editor option selects which of the settings files is opened by default when not using the above method, such as with the shortcut +, or through the application menu.

Footnotes

  1. The aforementioned settings, User and Workspace. Remote settings will appear when using WSL.

  2. By a test this maps to %APPDATA%\Roaming\Code\User\settings.json, I am not sure by what logic.

like image 106
kluvin Avatar answered Oct 17 '22 16:10

kluvin


On the settings UI page, there's a special button in the top right corner gutter that toggles between the settings.json file and the settings UI.

Open Settings (JSON)

Bonus Answer:

Add "workbench.settings.editor": "json" to your settings.json file. This will make it so that menu FilePreferencesSettings or + , opens your settings.json file by default. Optionally, add a comment at the top to remind yourself where the toggle button is.

// Click the Open Settings (UI) button in the top
// right corner gutter to toggle the settings UI
{
    // Other settings in settings.json
    // ...
    "workbench.settings.editor": "json"
}
like image 97
sevencardz Avatar answered Oct 17 '22 15:10

sevencardz


Follow these steps:

  • Shift + CMD + P
  • Type "settings"
  • Click on "Preferences: Open Settings (JSON)"

Visual Studio Code Tips and Tricks

like image 21
Mahdi Najjarian Avatar answered Oct 17 '22 15:10

Mahdi Najjarian