Cannot Edit Default VSCode JSON Settings
Asked Answered
E

4

88

I am using VSCode 1.47.3 on Windows 10. I cannot edit default settings in json:

  1. Open Default Settings ("File -> Preferences -> Settings")
  2. Type in Default Settings json file to edit.
  3. Window appears "Cannot edit in read-only editor"

I've tried opening VSCode as admin, uninstalling and reinstalling, restarting my computer, and downgrading to 1.46, but still cannot edit. Does someone know how to fix this?

Exarate answered 1/8, 2020 at 23:47 Comment(4)
It’s not an editable document, by design. You can edit settings using workplace or user settings.Neurath
Thank you. Was not clear to me. Tutorial I viewed did not distinguish between default and user/workspace settings.Exarate
No worries. Check this out for more info code.visualstudio.com/docs/getstarted/…Neurath
Some tutorials do show a JSON view of the settings where they manually type it in, you can edit those too, they are also user/workplace specific. Just go to your command palette and type Settings JSONNeurath
N
44

The default settings in vscode is a non-editable document. It acts as a way for you to view the default settings for native settings as well as extension default settings.

These defaults are also used to identify when a setting has changed with a 'blue' line indicator, when using the settings editor:

Changes to settings are reloaded by VS Code as you change them. Modified settings are now indicated with a blue line similar to modified lines in the editor. The gear icon opens a context menu with options to reset the setting to its default value as well as copy setting as JSON.

vscode settings changes

Currently, vscode only offers 2 editable settings:

VS Code provides two different scopes for settings:

  • User Settings - Settings that apply globally to any instance of VS Code you open.
  • Workspace Settings - Settings stored inside your workspace and only apply when the workspace is opened.

Workspace settings override user settings. Workspace settings are specific to a project and can be shared across developers on a project.

Note: A VS Code "workspace" is usually just your project root folder. Workspace settings as well as debugging and task configurations are stored at the root in a .vscode folder. You can also have more than one root folder in a VS Code workspace through a feature called Multi-root workspaces.

You can configure these settings with the settings editor, as pictured above, or you can navigate to their JSON counterparts for manual entry (example pictured on the right below).

json settings

For workspace settings JSON, the JSON file is located in a folder of the root directory called .vscode, you can create it yourself if it is not there.

By default, VS Code shows the Settings editor, but you can still edit the underlying settings.json file by using the Open Settings (JSON) command from your command palette or by changing your default settings editor with the workbench.settings.editor setting.


Settings

You can define which view is shown using the following settings:

  • workbench.settings.openDefaultSettings

    Opens the default settings any time you open regular settings (this only works with the JSON settings editor option)

  • workbench.settings.editor

    Determine which editor to use, you can elect UI or JSON

  • workbench.settings.useSplitJSON

    This will open a JSON settings editor, with the default settings to the left, but the default editor to the left will behave like a UI editor in that you can collapse regions based on category and there is a search input box and it will share the same tab as the json editor on the right, whereas the workbench.settings.openDefaultSettings option mentioned above puts each setting view in its own respective tab (editor)

Neurath answered 2/8, 2020 at 2:4 Comment(1)
Explicit answer. However, strange and very complex design by VS Code team!Courcy
D
10

I had the same problem and the solution that worked is below. It is true that default settings cannot be modified, but the below steps explain how to edit the settings in JSON:

  1. Cmd+Shift+P and select Open Settings UI (Ctrl+Shift+P for Windows I think)
  2. Search for "Settings" and under "Workbench" click on Settings Editor. Change from "ui" to "json".
  3. Search for “use split JSON” and tick “Controls whether to use split JSON…”.

Credit to Ahmad Awais video posted here

Dharana answered 6/1, 2022 at 23:25 Comment(0)
M
3

I had this same issue and finally figured it out. Go to Preferences >> Settings, expand Workbench >> Settings Editor.

From there, the first setting should be "Editor." Change it from UI to json, then close settings and reopen Preferences >> Settings.

Your settings will now open in a split-screen format where you can edit the file to the right.

Mediacy answered 23/8, 2022 at 15:55 Comment(1)
Not working. Probably it has something by permissionsSilverplate
N
-2

If you want to change the Global Settings, you will need to override the defaultSettings.json file by adding the json to settings.json

Press: Ctrl/cmd-shift-p

Type: settings.json

Select: Preferences: open settings.json

Just keep in mind that the workspace settings will still override the global settings.

Needlepoint answered 22/1, 2022 at 0:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.