Skip to content

Formatter is broken when using tabs #12175

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

Closed
joaomoreno opened this issue Nov 11, 2016 · 2 comments · Fixed by #12375
Closed

Formatter is broken when using tabs #12175

joaomoreno opened this issue Nov 11, 2016 · 2 comments · Fixed by #12375
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue VS Code Tracked There is a VS Code equivalent to this issue

Comments

@joaomoreno
Copy link
Member

joaomoreno commented Nov 11, 2016

TypeScript Version: 2.0.8

In VS Code I have configured tabs to be 2 characters wide ("editor.tabSize": 2). I noticed that some lines of code are incorrectly ignored by the formatter when using this setting.

For example, the formatter should outdent line two in the following snippet to 1 tab only, which initially has 2 tabs, and it fails to do so:

const foo = [
		1
];

Any other indentation on that line makes the formatter behave properly and format it with a single tab. It's only when using 2 tabs that it stays put.

It feels like the tab size is incorrectly taken into account when indenting using tabs, when it should simply be ignored. This is confirmed by setting tabSize to 3 and indenting line two with 3 tabs: the formatter will ignore that line. It also reproduces with tabSize of 4 (default) and indenting line two with 4 tabs. And so on...

cc @jrieken

@ramya-rao-a
Copy link

Any updates on this? Lots of users are seeing this.

@joaomoreno
Copy link
Member Author

cc @waderyan @dbaeumer

@waderyan waderyan added the VS Code Tracked There is a VS Code equivalent to this issue label Nov 21, 2016
@vladima vladima added the Fixed A PR has been merged for this issue label Nov 21, 2016
@mhegazy mhegazy added this to the TypeScript 2.1.3 milestone Nov 21, 2016
@mhegazy mhegazy added the Bug A bug in TypeScript label Nov 21, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue VS Code Tracked There is a VS Code equivalent to this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants