Skip to content

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

Closed

Description

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?

Activity

  1. alexdima commented on Nov 23, 2015

    @alexdima
    Member

    João Moreno (@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,
    ...
    }
    
  2. joaomoreno commented on Nov 23, 2015

    @joaomoreno
    ContributorAuthor

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

  3. alexdima commented on Nov 23, 2015

    @alexdima
    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

  4. joaomoreno commented on Nov 23, 2015

    @joaomoreno
    ContributorAuthor

    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.

  5. Tyriar commented on Nov 23, 2015

    @Tyriar
    Contributor

    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.

  6. hashhar commented on Nov 24, 2015

    @hashhar
    Contributor

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

  7. alexdima commented on Nov 24, 2015

    @alexdima
    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

  8. changed the title [-]Editor inserts tabs instead of spaces for indentation[/-] [+]Change the editor fallback defaults to insertSpaces: true, tabSize: 4[/+] on Nov 25, 2015
  9. added
    bug
    on Nov 25, 2015
  10. locked and limited conversation to collaborators on Nov 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions