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

Change the editor fallback defaults to insertSpaces: true, tabSize: 4 #498

Closed
joaomoreno opened this issue Nov 23, 2015 · 7 comments
Closed
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Milestone

Comments

@joaomoreno
Copy link
Member

I don't have a preference setting about spaces vs tabs. When I open .travis.yml, VSCode always uses tabs instead of spaces to create new indentation. This is very problematic since YAML files forbid tabs.

image

I thought the editor would automatically figure out the indentation to use?

@alexdima
Copy link
Member

@joaomoreno

Our project settings force the insertion of tabs:

.vscode/settings.json

// Place your settings in this file to overwrite default and user settings.
{
    "editor.insertSpaces": false, // <---- THIS IS THE ONE
    "files.trimTrailingWhitespace": true,
...
}

@joaomoreno
Copy link
Member Author

Should this only act on when there is no definite hint about the file's indentation? E.g.: new files.

@alexdima
Copy link
Member

The settings get applied by the workbench to each editor regardless the model being for an empty file or not. If this setting is left out, then the model is used for guessing. If the guessing code is not confident, it falls back to insertSpaces:false, tabSize:4. The fallback values have no configuration story.

I think our intent here is to say: "all TypeScript, CSS and JS files should use tabs". This sounds to me as a great usecase for .editorconfig

@joaomoreno
Copy link
Member Author

Is there any mode specific configuration instead? YAML actually banned tabs, so our editor putting one in there is just wrong. That is true for our project as it is for every user out there writing YAML.

@Tyriar
Copy link
Member

Tyriar commented Nov 23, 2015

I've run into this too, I want the behavior of auto but fallback to space, not tab. Not sure if atom does anything special here or just falls back to space by default.

@hashhar
Copy link
Contributor

hashhar commented Nov 24, 2015

For those wondering, Atom also falls back, but to spaces.
Spaces is a better option because almost all compilers support spaces.

@alexdima
Copy link
Member

I'm ok with changing the fallback values, I especially like the reasoning that all compilers support spaces.

So the action out of this issue is to change the fallback defaults to insertSpaces: true, tabSize: 4

@alexdima alexdima changed the title Editor inserts tabs instead of spaces for indentation Change the editor fallback defaults to insertSpaces: true, tabSize: 4 Nov 25, 2015
@alexdima alexdima added the bug Issue identified by VS Code Team member as probable bug label Nov 25, 2015
@alexdima alexdima added this to the Dec 2015 milestone Dec 16, 2015
@alexdima alexdima assigned joaomoreno and unassigned alexdima Dec 16, 2015
@joaomoreno joaomoreno added the verified Verification succeeded label Dec 16, 2015
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants