Ben Taliadoros
Ben Taliadoros

Reputation: 9511

How to specify different formatting for different files in VS code/Prettier

Does anyone know if it's possible to have VS Code auto format different file extensions differently?

For example I want:

JS - 4 spaces, CSS - 2 spaces and HTML - 2 spaces

Upvotes: 0

Views: 316

Answers (1)

mdatsev
mdatsev

Reputation: 3879

You can use Language Specific Settings. In your settings.json do like so:

{
  "[javascript]": {
    "editor.tabSize": 4
  },
  "[css]": {
    "editor.tabSize": 2
  },
  "[html]": {
    "editor.tabSize": 2
  }
}

Upvotes: 2

Related Questions