VS Code stores each setting in more than one place, and they don't carry equal weight. Here's how user and workspace scopes work, and which one wins.
Adapted from the VS Code Essentials Companion Guide.
You change a setting in VS Code, and nothing happens. Or a setting you changed last month has quietly reverted. Or a teammate's project behaves differently from yours, even though you're running the same version.
Most of the time, the cause isn't a bug. VS Code stores each setting in more than one place, and those places don't all carry equal weight. Once you know the order, you can predict which value is in effect and why.
Two scopes you'll use every day
User settings are personal. They apply to every VS Code window you open on your computer. If you set the editor font size to 14 here, it's 14 everywhere.
Workspace settings belong to one project. They apply only when that folder is open, and they're stored in a .vscode/settings.json file at the root of the project. Because the file lives inside the project, it can be committed to Git and shared with everyone who works on it.
The rule that ties them together: workspace settings override user settings. If your user setting says one thing and the project's setting says another, the project wins while that folder is open. Microsoft's docs state it the same way: "later scopes override earlier scopes" in the precedence list, and workspace comes after user.
The full order, briefly
From weakest to strongest, the layers go like this: defaults, then user settings, then remote settings (when connected to a remote machine), then workspace settings, then workspace-folder settings (only in a multi-root workspace). Language-specific versions of each come after, and policy settings set by an organization's administrator sit on top of everything.
For everyday use, you can remember three of those:
- User settings are your personal baseline.
- Workspace settings override your baseline for one project.
- Language-specific settings override both for a particular file type.
Language-specific settings
You can attach settings to a language by putting them inside a block named with the language ID in square brackets:
{
"[python]": {
"editor.tabSize": 4
},
"[markdown]": {
"editor.wordWrap": "on"
}
}
These apply only to files of that type. One detail surprises people: a language-specific setting overrides a non-language-specific setting even when the non-language one comes from a narrower scope. In other words, a language-specific user setting beats a plain workspace setting. If a workspace setting seems to be ignored for one file type, look for a [language] block in your user settings.
Which values replace and which merge
Most settings, such as strings, numbers, booleans and lists, simply get replaced: the winning scope's value is used and the other is ignored. Settings whose value is an object get merged instead. For example, workbench.colorCustomizations in your user settings and in a workspace file are combined, and the workspace value only wins for keys that appear in both. That's why a workspace can add to your customizations without wiping them out.
Where to look and edit
You don't have to hunt for the files. Open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P) and run one of these:
- Preferences: Open User Settings (JSON)
- Preferences: Open Workspace Settings (JSON)
If you prefer a visual editor, run Preferences: Open Settings and use the User and Workspace tabs at the top. Each tab shows the values for that scope, so you can compare them.
If you do need the files themselves, the user file lives at %APPDATA%\Code\User\settings.json on Windows, $HOME/Library/Application Support/Code/User/settings.json on macOS, and $HOME/.config/Code/User/settings.json on Linux. The workspace file is always .vscode/settings.json inside the project.
Debugging a setting that isn't doing what you expect
1. Check the Workspace tab first. In the Settings editor, switch between User and Workspace and search for the setting. If the Workspace tab has a value, it's overriding yours.
2. Use the @modified filter. Type @modified into the Settings search box to list every setting that's been changed from its default, in whichever scope you're viewing. It's the fastest way to find a setting you forgot you changed, or one someone else committed to the project.
3. Look for a language block. If the problem is only in one kind of file, search for the language in your settings JSON.
4. Watch for a broken file. If VS Code says "Unable to write into user settings", your settings.json has a syntax error, such as a missing comma. Open it with the command above and look for the red squiggles.
Two mistakes worth knowing about ahead of time
Putting personal preferences in the workspace file. If .vscode/settings.json is committed to a shared repository, everything in it applies to everyone who opens the project. Your font, theme and zoom level belong in user settings. Reserve workspace settings for things the whole team should share, like a formatter, a rule for excluding node_modules from search, or the project's tab size.
Expecting a workspace to control everything. Some settings can only be set in user settings, for security reasons. The ones that point at an executable to run, such as git.path and the external-terminal settings, are ignored if they appear in a workspace file, so a project you open can't make VS Code launch a program you didn't choose. And if your organization manages VS Code, administrator-set policy values override whatever you configure.
If your editor is picking the wrong Python even though you changed a setting, that's often a workspace-level interpreter choice at work. VS Code Is Running the Wrong Python walks through that case.
A habit that keeps it simple
Ask one question before saving a setting: does this describe me, or does it describe the project? If it describes you (theme, font, how you like your editor to look), put it in user settings so it follows you everywhere. If it describes the project (formatter, indentation, folders to ignore), put it in the workspace so it follows the project. Sorting settings this way keeps your personal setup out of shared repositories, and when something misbehaves, you already know which of two places to check first.
If you'd like more posts like this sent straight to your inbox, subscribe to the newsletter.
Prefer to dig in yourself? The VS Code Essentials repo on GitHub has more free examples and exercises.
Top comments (0)