Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
trivikr opened this issue Jan 5, 2018 · 4 comments
Closed

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

trivikr opened this issue Jan 5, 2018 · 4 comments
Assignees
Labels
javascript JavaScript support issues

Comments

@trivikr
Copy link

trivikr commented Jan 5, 2018

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)?

@vscodebot vscodebot bot assigned mjbvz Jan 5, 2018
@vscodebot vscodebot bot added the javascript JavaScript support issues label Jan 5, 2018
@usernamehw
Copy link
Contributor

"[javascript]": {
  "editor.tabSize": 2
}

@trivikr
Copy link
Author

trivikr commented Jan 5, 2018

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

"[javascript]": {
  "editor.tabSize": 2
}

@usernamehw
Copy link
Contributor

I'm not the one to decide this.

@mjbvz
Copy link
Collaborator

mjbvz commented Jan 5, 2018

  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

@mjbvz mjbvz closed this as completed Jan 5, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Feb 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
javascript JavaScript support issues
Projects
None yet
Development

No branches or pull requests

3 participants