makxca
makxca

Reputation: 26

VS Code: How to automatically remove double spaces on save?

I want VS Code to automatically correct spaces when saving a JSON file (I do not want this rule to be applied to any other types of files, but this is not crucial)

Example:

// before saving
{
  "someField":       "value"
}

// after saving
{
  "someField": "value"
}

I've searched the internet, and there are lots of articles on how to remove trailing spaces automatically when saving a file. But this is not the case

Solution that worked for me

I added this rule to my settings.json:

"[json]": {
    "editor.formatOnSave": true
}

Upvotes: 0

Views: 38

Answers (0)

Related Questions