Microsoft/vscode

Resetting various settings can delete comments from settings.json file

Open

#275 792 ouverte le 6 nov. 2025

Voir sur GitHub
 (4 commentaires) (0 réactions) (1 assigné)TypeScript (10 221 forks)batch import
configfeature-requesthelp wantedsettings-editor

Métriques du dépôt

Stars
 (74 848 stars)
Métriques de merge PR
 (Merge moyen 11h 43m) (1 000 PRs mergées en 30 j)

Description

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.105.1
  • OS Version: Linux x64 6.17.6-1-default
Version: 1.105.1
Commit: 7d842fb85a0275a4a8e4d7e040d2625abbf7f084
Date: 2025-10-14T22:33:36.618Z
Electron: 37.6.0
ElectronBuildId: 12502201
Chromium: 138.0.7204.251
Node.js: 22.19.0
V8: 13.8.258.32-electron.0
OS: Linux x64 6.17.6-1-default

Description:

When going from anything but window.zoomLevel: 0 to window.zoomLevel: 0 via either

  • the UI "View/Appearance/Zoom In" or "View/Appearance/Zoom Out"
  • or the Keyboard Shortcuts "Ctrl+=" or "Ctrl+-",

the setting disappears from the User settings.json via deleting it's line but also deletes one line above it, should it be a comment or another commented out line.

See attached screenshots of a diff from my settings.json file after resetting the zoom level to 0 via keyboard shortcut "Ctrl+=" (e.g. going from window.zoomLevel: -0.5 to window.zoomLevel: 0):

Steps to Reproduce:

  1. Start in neutral zoom setting (window.zoomLevel: 0)
  2. Press "Ctrl+-" to set window.zoomLevel: -1
  3. Find window.zoomLevel: -1 in your user settings.json file
  4. Add a line above the setting with a comment: // test
  5. Save and close settings.json
  6. Press "Ctrl+=" to set window.zoomLevel: 0
  7. Try finding window.zoomLevel in your user settings.json, it is gone (expected)
  8. Try finding your manually added comment one line above it, it is also gone (bug)

Suggestion:

Naive first idea: Allow the window.zoomLevel setting to remain in the user settings.json file, even at value "0".

Guide contributeur