-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed as duplicate of#80449
Closed as duplicate of#80449
Copy link
Labels
Milestone
Description
Repro:
In VS2015 with update 1, set the C# formatting preferences to insert spaces before and after binary operators.
Write the following class:
class C
{
public static event Action E;
}(static doesn't influence the bug, it's just more convenient for the next example)
Then write exactly the following code in a method:
C.E+=() =>
{
}Format the file.
Expected result:
C.E += () =>
{
}Actual result:
C.E += () =>
{
}The indent of the body is wrong.
Experimenting a bit, it seems the body indent is (1 - <#spaces left of +=>) + (1 - <#spaces right of +=>) when it should be 0.
Adding things to the lambda body before formatting gets funky results, especially if comments are involved (some statements are indented, some aren't, the closing brace isn't always indented...).