Reputation: 389
I'm currently using VSCode and I have this problem. I want to set the space size equals to 1 and tab size equals to 2 as default for every project. But it still set back as spaces: 4 for every project. And as I set the spaces = 2, and run Beautify file. Everything looks good with space = 2. Then I hit save it format my file to indent size 4. How do I set it as default equal to 2 guys?
even I change in User settings
Upvotes: 11
Views: 21736
Reputation: 4596
EditorConfig is a handy standard for establishing project wide formatting options: http://editorconfig.org.
There's a VSCode extension supporting it: https://github.com/editorconfig/editorconfig-vscode
This doesn't directly answer your question, but it works well. And if you switch editors, you still can keep your formatting standard by getting each editor's plug-in for EditorConfig.
Upvotes: 2
Reputation: 1044
By default VSCode try to detect indent option for a file. So set editor.detectIndentation to false
// When opening a file, `editor.tabSize` and `editor.insertSpaces` will be detected based on the file contents.
"editor.detectIndentation": false,
Upvotes: 15