-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Outdent issue with Typescript #9409
Comments
@wallverb I can not reproduce this problem. |
@weinand here are the steps to recreate:
5 - Try to outdent: If works then proceed to step 6 6 - Close VSCode I'm getting the issue from above screenshots |
@wallverb I can reproduce with your snippet. This issue is independent from TypeScript. The snippet has inconsistent indentation: 6 lines seem to use 4 spaces for one indentation level, 3 lines use 2 spaces. Since you are probably using the default editor setting Since the outdent operation has to move the lines to valid tab positions, the result is unexpected but correct. Your expected behaviour would require a tabSize of 2. To achieve this, you will have to use these settings: "editor.tabSize": 2,
"editor.detectIndentation": false |
Right, I knew it was related to mix of 2 spaces and 4 spaces tabs - but even that assuming that VSCode detected In other words: (assuming Current outdent operation results in: (notice how children got unaligned) Ideal situation would be if VSCode could "fix" the indentation difference and for example create this output: ( or at least just move everything by 2 spaces to the left (so `"data" follows the 4 spaces tab) or (what Atom does) - just move everything 4 spaces to the left - without "breaking children" |
This issue touches on two topics:
I think both behaviours have pros and cons. i.e. I have a feeling they should be expressed as settings. |
IMO dumb indentation should be the default, since that's the default behavior for most editors, and is least likely to break existing formatting. Especially in languages like Clojure where partial indents are very prevalent (see #15598). That's my 2c, but as long as it's configurable at all as a setting, I can live with it. |
Setting |
Steps to Reproduce:
1 - Highlight
2 - Outdent with Cmd + [
Result (first issue):
3 - Outdent again with Cmd + [
Result (second issue):
Expected behavior:
First outdent:
Second outdent:
The text was updated successfully, but these errors were encountered: