Introduction
Visual Studio Code keeps its settings in
files named settings.json. The user settings apply everywhere and live in
the user’s profile: %APPDATA%\Code\User\settings.json on Windows,
~/Library/Application Support/Code/User/settings.json on macOS and
~/.config/Code/User/settings.json on Linux. Workspace settings, in a
project’s .vscode/settings.json, override them for that project and are
often shared with the code.
The Settings screen in VS Code edits the same files, and the command “Open User Settings (JSON)” opens the file itself. Editors built on VS Code, such as VSCodium, use the same format in their own folders.
Structure
The file (see syntax, files and
scopes) is JSON with two relaxations, which
VS Code calls JSON with Comments: // and /* */ comments are
allowed, and a trailing comma is tolerated. The top level is one object. Its keys are
setting IDs with dotted names, such as editor.fontSize or
files.autoSave, and are not nested by their dots. A key made of a language
name in square brackets, such as "[python]", holds an object of settings
that apply only to that language.
The explorer’s Settings tab shows each setting’s type, default and meaning from a table extracted from VS Code’s source. The table does not hold every built-in setting: a setting it lacks is labelled as not in the table, which does not mean VS Code rejects it (see Not described below).
{
// Editor
"editor.fontSize": 14,
"files.autoSave": "afterDelay",
"[python]": {
"editor.tabSize": 4
}
}
Not described
Known, not yet covered
- Viewer: the table of known settings is extracted by a script from the source of Visual Studio Code (the microsoft/vscode repository, a stated commit, including the manifests of the extensions in that repository). It covers the settings registered in a form the script can read. It does not hold settings whose keys or schemas are built at run time (for example
files.hotExit,editor.lineHeight, theeditor.unicodeHighlight.*settings andeditor.mouseWheelZoom; a check of about 600 registered keys found 11 such keys absent, and some chat and terminal settings may be too), so a wrong value of such a setting gets no type or range note, nor the settings of built-in extensions that ship separately from the repository (for example the JavaScript debugger’sdebug.javascript.*). The viewer labels such a setting, as a note and never an error, “not in the settings table extracted from VS Code’s source at commit …; VS Code may still define it … or an installed extension may”; its value is still shown, with no type, default or meaning. The table follows the main branch, not a release, so a given VS Code build can differ from it. - Viewer: a file named
settings.jsonwhose text starts with an object opens as Visual Studio Code settings, whatever program wrote it: another editor’ssettings.json(for example Zed’s) is read the same way, and its keys are labelled as not in the table.
Also used for
- Browser extension manifest – The JSON manifest of a browser extension: its name, permissions and scripts.
- GeoJSON – Map points, lines and areas with properties, written as JSON.
- Hugging Face model config (config.json) – config.json: a model’s architecture and sizes, read before the weights.
- Hugging Face tokenizer (tokenizer.json) – tokenizer.json: a language model’s vocabulary and tokenising rules.
- JSON Schema – A JSON document that describes and validates other JSON documents.
- JavaScript Object Notation – Text format for objects, arrays, strings, numbers and booleans.
- Lottie animation – Vector animations as JSON, exported from After Effects and played in apps and web pages.
- jCal: iCalendar in JSON – iCalendar as JSON: events, to-dos and time zones as nested arrays.
- jCard: vCard in JSON – vCard 4.0 contacts as JSON: names, numbers and addresses as arrays.
- npm package manifest (package.json) – A JavaScript package’s name, version, scripts and dependencies, in JSON.
Links
Software
- Visual Studio Code – Microsoft’s free code editor, which reads and writes these settings (Windows, macOS, Linux)
- VSCodium – a build of VS Code without Microsoft’s branding and telemetry (Windows, macOS, Linux)
Developers
- jsonc-parser – the library VS Code uses to read and edit JSON with comments (JavaScript)
Reference
- User and workspace settings – Visual Studio Code documentation