microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
160.53k stars 28.11k forks source link

Can we switch default "editor.tabSize" from 4 to 2 for indentation? #41200

Closed trivikr closed 6 years ago

trivikr commented 6 years ago

I noticed that VSCode adds default editor.tabSize as 4 Is there a reason for doing this?

I went through some popular JavaScript projects, and noticed that all of them use 2 spaces for indentation:

When it comes to TypeScript projects, they also use 2 spaces for indentation:

Only Microsoft projects seem to use 4 spaces for indentation (may be because of C# influence?):

I noticed that popular JavaScript formatters/standards use 2 spaces for indentation:

Is the value of editor.tabSize 4 because VSCode is used for other languages (like Python) where 4-spaces is a standard? If yes, can language specific indentation setting can be created (say javascript.tabSize)?

usernamehw commented 6 years ago
"[javascript]": {
  "editor.tabSize": 2
}
trivikr commented 6 years ago

Thanks @usernamehw, can the following code be added as default settings in VSCode?

"[javascript]": {
  "editor.tabSize": 2
}
usernamehw commented 6 years ago

I'm not the one to decide this.

mjbvz commented 6 years ago
  1. Four spaces is a reasonable default IMO. It is not more or less right than 2 space indentation
  2. You can very easily change it
  3. Changing the default now would be super painful, as operations like format would suddenly start reformatting documents for any user that has not set editor.tabSize