Skip to content

Different behaviors of indent_size and tab_width between editors (Emacs, VSCode) #389

@kogiokka

Description

@kogiokka

.editorconfig (for example)

root = true

[*]
indent_style = tab
indent_size = 2
tab_width = 5
insert_final_newline = true
trim_trailing_whitespace = true

Indent with/without space

Emacs indents the code with 2 spaces. Wherever the count of spaces meets 5, Emacs replaces it with a tab. On the other hand, VSCode indent the code with 5-space-long tab in the first place.

Emacs

bugreport01

VSCode

bugreport02

Space to Tab exchange rate in code alignment

Set tab_width to 10 in .editorconfig for example.

Emacs replaces 10 spaces with a tab, while VSCode replacing 4 spaces with a tab and display the tab 10 spaces long.

Emacs

bugreport04

VSCode

bugreport03

Expect behavior

A consistent behavior across different editors. Although I'm not sure which implementation is "more correct".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions