# VS Code Settings Not Saving
You change a setting in VS Code, close the editor, and when you reopen it, the setting is back to its old value. Or you edit settings.json directly, but VS Code ignores your changes. Settings sync keeps overwriting your local preferences. These frustrations point to underlying issues with VS Code's settings hierarchy or storage.
Understanding Settings Hierarchy
VS Code settings exist at multiple levels, each overriding the previous:
- 1.Default settings - VS Code's built-in defaults
- 2.User settings - Global preferences stored in
settings.json - 3.Workspace settings - Project-specific in
.vscode/settings.json - 4.Language settings - Overrides for specific file types
A setting at a higher level overrides lower levels. If you set editor.fontSize: 14 in user settings, but .vscode/settings.json has editor.fontSize: 12, you'll see 12 in that workspace.
Step 1: Check for Workspace Override
The most common "settings not saving" issue is workspace overrides:
Check workspace settings: ```bash # Look for .vscode folder ls -la .vscode/
# If it exists, check settings.json cat .vscode/settings.json ```
- 1.In VS Code Settings UI:
- 2.Open Settings (
Ctrl+,) - 3.Search for the problematic setting
- 4.Look for "Workspace" override indicator
- 5.Hover over the setting to see both values
If a workspace setting overrides your preference, either: - Delete the workspace setting - Or accept that workspace settings intentionally override user settings
Step 2: Fix Corrupted settings.json
JSON syntax errors cause settings to fail silently:
Open user settings:
Press Ctrl+Shift+P → "Preferences: Open User Settings (JSON)"
Common JSON errors:
```json // WRONG: Trailing comma { "editor.fontSize": 14, }
// WRONG: Missing comma { "editor.fontSize": 14 "editor.tabSize": 2 }
// WRONG: Single quotes { 'editor.fontSize': 14 } ```
Correct format:
``json
{
"editor.fontSize": 14,
"editor.tabSize": 2
}
VS Code should show red squiggles on syntax errors. Fix them and save.
Step 3: Resolve Settings Sync Conflicts
If you use Settings Sync, conflicts can cause settings to revert:
Check sync status: Click the gear icon in bottom left → "Settings Sync is On" (or Off)
- 1.View sync conflicts:
- 2.Press
Ctrl+Shift+P - 3."Settings Sync: Show Synced Data"
- 4.Check for conflict indicators
Resolve conflicts: - "Settings Sync: Accept Local" - Use your local settings - "Settings Sync: Accept Remote" - Use cloud settings
Exclude settings from sync:
``json
{
"settingsSync.ignoredSettings": [
"editor.fontSize",
"workbench.colorTheme"
]
}
Step 4: Check File Permissions
Settings file might be read-only or owned by another user:
- 1.Windows:
- 2.Navigate to
%APPDATA%\Code\User - 3.Right-click
settings.json→ Properties - 4.Ensure "Read-only" is unchecked
- 5.Security tab → Ensure your user has Write permission
macOS/Linux: ```bash # Check permissions ls -la ~/Library/Application Support/Code/User/settings.json # macOS ls -la ~/.config/Code/User/settings.json # Linux
# Fix ownership sudo chown $(whoami) ~/.config/Code/User/settings.json
# Fix permissions chmod 644 ~/.config/Code/User/settings.json ```
Step 5: Find the Correct Settings File
VS Code stores settings in specific locations depending on installation mode:
Standard installation:
- Windows: %APPDATA%\Code\User\settings.json
- macOS: ~/Library/Application Support/Code/User/settings.json
- Linux: ~/.config/Code/User/settings.json
Portable mode:
- data/user-data/User/settings.json (next to executable)
Check if you're editing the wrong file:
``bash
# Find all settings.json files VS Code might use
find ~ -name "settings.json" -path "*Code*" 2>/dev/null
Step 6: Handle Extension Settings Conflicts
Extensions can contribute settings that override defaults:
- 1.Find extension contributions:
- 2.Open Settings (
Ctrl+,) - 3.Search for "@modified" to see all changed settings
- 4.Hover to see which extension contributed a setting
Check extension settings:
Extensions often add language-specific defaults:
``json
// Example: Python extension defaults
"python.formatting.provider": "autopep8",
"[python]": {
"editor.formatOnSave": true
}
Disable or reconfigure the extension if its defaults conflict with your preferences.
Step 7: Fix Language-Specific Overrides
Settings for specific languages override general settings:
Check for language overrides:
``json
// In settings.json, look for sections like:
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
These override your general formatter setting for those languages. Modify or remove them if needed.
Step 8: Reset and Start Fresh
If settings are completely corrupted, reset everything:
Backup first:
``bash
cp ~/.config/Code/User/settings.json ~/.config/Code/User/settings.json.backup
Clear settings:
``json
// Replace settings.json content with minimal valid JSON
{}
Or delete the file:
``bash
rm ~/.config/Code/User/settings.json
VS Code will recreate it with defaults on next launch.
Reload window:
Press Ctrl+Shift+P → "Developer: Reload Window"
Then manually re-add your settings from the backup.
Verification
Test settings persistence:
- 1.Change a setting (e.g.,
editor.fontSize) - 2.Save and close VS Code completely
- 3.Open VS Code
- 4.Verify the setting persists
- 5.Test in different workspaces to check for workspace overrides
Common Scenarios
| Issue | Cause | Fix |
|---|---|---|
| Setting reverts | Workspace override | Remove from .vscode/settings.json |
| JSON not parsed | Syntax error | Fix trailing commas, quotes |
| Sync keeps changing | Settings Sync active | Use ignoredSettings or accept local |
| Can't save file | Permission denied | Fix file ownership/permissions |
| Different in different projects | Workspace settings | Understand hierarchy |
Settings persistence issues almost always stem from the hierarchy (workspace overrides user) or JSON corruption. Check both systematically.