0

Installed Prettier. Want to set preferences to format on paste and save but getting error message - unable to write into user settings. Please open the user settings to correct errors/warnings in it and try again.

To format prettier I went into the extension, typed in format and tried to select Format on paste and format on save. That's when the error message appeared. When I check settings, I see this:

"editor.formatOnPaste": true,
  "editor.formatOnSave": true,
  "[jsonc]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[html]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  }

What can I do?

VEA
  • 1

1 Answers1

0

Follow the steps it might help you:

  1. Open the user settings file by going to Preferences > Settings in the VS Code editor, or by pressing the keyboard shortcut Ctrl+ (on Windows) or Cmd+ (on Mac).

  2. In the Settings editor, find the section for "editor.formatOnPaste" and "editor.formatOnSave". Make sure that these settings are set to true, like this:
    "editor.formatOnPaste": true,
    "editor.formatOnSave": true,

  3. Check the rest of the file for any syntax errors or warnings. In your case, it looks like there is an extra comma at the end of the "[jsonc]" and "[html]" sections, which is causing the error. Remove the extra comma, and make sure that the file is properly formatted and indented.

  4. Save the changes to the file, and try setting the formatting options again.

This should work now that the syntax errors have been fixed.

Andy A.
  • 1,392
  • 5
  • 15
  • 28
  • Hello! Many thanks for your response. I am new to this, so don't know which one of the commas to remove or how to format and indent them properly. I would like some direction please? Many thanks in advance. – VEA Dec 08 '22 at 12:14