Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are ALL configuration files used by Visual Studio Code?

VS Code from what I know handles User and Workspace configurations in JSON format. It creates .vscode folder in the working directory (when necessary) and another in user home (e.g. used to store marketplace extensions).

I'm wondering if there's also another place.

For example, if you create a file without using New File button, e.g. from terminal:

echo "dummy" >dummy.abc

And then you open it in the editor, you will be prompted with a dialog like this:

VS Code marketplace dialog

If you hit Don't Show Again... and repeat the same experiment in the same directory or in another, VS Code will remember it (it will not present the dialog a second time).

I know it's not an important thing... But I want to know where this is stored.

So, are there any other config file that VS Code uses?

like image 259
gsscoder Avatar asked Nov 17 '19 12:11

gsscoder


People also ask

Where are VS Code configuration files?

The workspace settings file is located under the . vscode folder in your root folder. Note: For a Multi-root Workspace, workspace settings are located inside the workspace configuration file.

What is the code to add run configuration in Visual Studio?

To bring up the Run and Debug view, select the Run and Debug icon in the Activity Bar on the side of VS Code. You can also use the keyboard shortcut Ctrl+Shift+D. The Run and Debug view displays all information related to running and debugging and has a top bar with debugging commands and configuration settings.

Where is the code in all files in Visual Studio?

VS Code allows you to quickly search over all files in the currently opened folder. Press Ctrl+Shift+F and enter your search term. Search results are grouped into files containing the search term, with an indication of the hits in each file and its location.


Video Answer


3 Answers

I'm under the impression that nobody else got your question right...

There are at least 3 different configurations files that i know of that can be transfered quickly to a new VSCode setup to reproduce all your configurations:

  1. settings.json
  2. keybindings.json
  3. snippet.code_snippets (last one needing to be created by the user first for his own custom snippets if needed; there could be more then one of those)

On Windows, you can find them under the path: C:\Users\YourUserName\AppData\Roaming\Code\User

You can also create list your extensions by using the code CLI. There's also a CLI command to install your extensions. code --help will give you more info if necessary. You can also take a look at this thread: How can you export the Visual Studio Code extension list?

code --list-extensions > ^
C:\Users\YourUserName\AppData\Roaming\Code\User\my_extensions.md

Be aware that if you are using Remote SSH, this command will give you different results depending on whether you are on your local VSCode or on a remote development workspace.

like image 65
rollingtatoo Avatar answered Oct 11 '22 23:10

rollingtatoo


You have default settings, user settings, workspace settings, single folder settings (legacy) and repository settings.

You can access your defaultSettings.json by typing "default settings" in the command palette (Shift+Cmd+P or Shift+Ctrl+P in Windows/Linux).

You can access your user settings.json file by pressing Cmd+, (or Ctrl+, in Windows/Linux).

The workspace settings go inside a .code-workspace file in the "settings" key, like so:

{
    "settings": {
        "breadcrumbs.enabled": true // Settings here
    }
}

The single-folder settings go into the /.vscode/settings.json file. The single-folder state is a legacy feature. You can insert both repository-wide and workspace-wide settings inside the /.vscode/settings.json file when in a single-folder state but workspace settings stop working if you turn that into a workspace. This can be confusing because VS Code creates an implicit/unsaved workspace if you choose the "Remove folder from Workspace" or the "Add folder to workspace" options in your file explorer. enter image description here

The repository settings go into the /.vscode/settings.json file.

I've recorded a video on where settings are applied that contains a slight misconception, which I'm hoping to correct soon, around the single-folder legacy functionality that I was not aware of at the time of the recording. I hope this helps :)

like image 30
André Casal Avatar answered Oct 11 '22 23:10

André Casal


The VS Code docs mention the location for the settings files:

Depending on your platform, the user settings file is located here:

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

If you take a look at the Code folder, there are a bunch of other files stored there:

Code$ tree -L 1
.
├── Backups
├── Cache
├── CachedData
├── CachedExtensions
├── Code\ Cache
├── Cookies
├── Cookies-journal
├── GPUCache
├── Local\ Storage
├── Network\ Persistent\ State
├── Preferences
├── User
├── Workspaces
├── blob_storage
├── languagepacks.json
├── logs
├── machineid
├── rapid_render.json
├── storage.json
└── webrtc_event_logs

Those contain all the settings/configurations that VS Code maintains (apart from the .vscode folder in your workspace). If you delete the Code folder, your VS Code would then behave like it was freshly installed.

Most of them aren't easily readable like JSON though, and most are stored in SQL DB files (.vscdb). For example, for remembering that "Don't Show Again" prompt for files with .abc extensions, it's stored in User/globalStorage/state.vscdb. Use a SQLite browser (like this) to open up that file, and you'll see this:

enter image description here

...which stores the setting to not prompt me again for .csv and .abc files. (Try removing the "abc" from the DB value, and VS Code will prompt you again.)

For workspace-specific settings, they are stored in User/workspaceStorage, where each workspace is organized into folders like this:

workspaceStorage$ tree -L 1
.
├── 145974865976a98123d05b3b96dbf2c5
├── 20159dfdb7c4cda12efaac5f8e64a954
├── 33fd12012abefa2f7f2f0a3f185999cf
├── 34a3fbd8b284b6cfb29882db362faa4e
├── 44b251d79bd7f8f49c350d022bf7d03d
├── 63d838186f19687db224f4f7a27c62ab
...

Go into any one, and check the workspace.json to know which workspace the DB file is for. Then again open the state.vscdb to see something like this:

enter image description here

...which shows settings for remembering which files are opened, etc..

like image 38
Gino Mempin Avatar answered Oct 11 '22 22:10

Gino Mempin