-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Auto-indentation problem with promise blocks #10335
Comments
From @waderyan on August 12, 2016 15:0 Thank you for opening this issue. We appreciate your feedback greatly. Couple questions.
Here I have copied your code sample and ran format code with spaces set at 4. I have repeated the same test with no issues for spaces preference set to 2 and set to tabs. |
From @lumaxis on August 12, 2016 15:41
|
From @waderyan on August 12, 2016 19:52 Ok. Unfortunately, I can repo your issue. Is there anything else you can think of the makes your setup different than me? I'm on the same OS and same Insiders build... I have tried with all spaces / tabs configuration but cannot see the behavior you described. @dbaeumer - I can't repo. Do you have any ideas? |
From @lumaxis on August 12, 2016 21:23 @waderyan But I can see the issue repro in your gif. I'll try to give a clearer example: Correctly formatted code: function doStuff() {
new Promise(function () {
return "some string";
})
.then((something: string) => {
something.split(" ");
});
} After VS Code "Format Code": function doStuff() {
new Promise(function () {
return "some string";
})
.then((something: string) => {
something.split(" ");
});
} Notice how the |
From @waderyan on August 12, 2016 21:31 Thank you for clarifying. Yes I see the issue and was able to repo. I agree with your preference. |
This is the tsserver formatting the code that way. @waderyan to see whether something is a tsserver bug you can enable message tracing by setting
Which changes the two spaces to four. Moving to the TS team. |
Isn't this by design? I thought property accesses are being indented intentionally. foo
.bar
.baz |
@saschanaz If that is the case it's imo a very questionable decision that at least would need an option to be able to change it. });
});
});
}); |
I'd like to take a stab at this but as someone new to this codebase, it's pretty hard to figure out where to start or how to debug a change to the server like this. |
any news on this? |
Thsis is not fixed yet right? |
Still no resolution? |
And still nothing? |
From @lumaxis on August 12, 2016 0:7
Steps to Reproduce:
Shift+Alt+DShift+Alt-FExpected Result:
Actual Result:
Description:
The problem with the current way is that it leads to a strange indentation on the closing braces:
Here, the closing curly braces and parentheses for the
.then()
block are indented 4 spaces instead of 2 spaces as they should be.Copied from original issue: microsoft/vscode#10453
The text was updated successfully, but these errors were encountered: