-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Description
Ported from TFS WorkItem: 1107386
Repro Steps:
Affected Branch:
Affected Build:
Affected Product Language:
Steps to reproduce:
1. Create a new C# class library.
2. Add the following method:
void M()
{
int x = 5;
// Foo bar baz
}
3. Put the cursor on the "int x = 5;" line.
4. Press Ctrl+. to bring up the light bulb.
5. Hit enter to add the #pragmas.
Expected
The indentation of "// Foo bar baz" remains the same.
Actual
The comment is pushed over to the right. That is, you end up with something like this:
void M()
{
#pragma suppress CS2091
int x = 5;
#pragma restore CS2091
// Foo bar baz
}
Revisions:
- Created by Tom Meschter (1/13/2015 12:21:30 PM)
- Edited by Srivatsn Narayanan (1/13/2015 6:46:36 PM)
- Edited by Shyam Namboodiripad (1/14/2015 1:42:19 PM)
This is actually a known bug in the formatter. Unless Kevin is willing to reconsider :) this can be resolved as a dupe of 1079746.
- Edited (Active to Resolved) by Manish Vasani (1/14/2015 2:07:42 PM)
- Edited (Resolved to Active) by Tom Meschter (1/14/2015 2:53:51 PM)
Reactivating.
I took a look at 1079746 and I think this is a different issue.
In 1079746 you start with incorrectly formatted code, and inserting the suppression fixes the formatting. We may end up formatting things not directly connected to the trivia we're inserting, but the end result is fine.
In this bug, you start with correctly formatted code, and inserting the #pragma makes it incorrect. So you then have to run "Format Document" or similar to clean up the results of the suppress action.
I've updated the repro steps to show the output from the suppress action.
- Edited by Srivatsn Narayanan (1/14/2015 3:11:00 PM)
- Edited by Srivatsn Narayanan (1/16/2015 6:00:22 PM)
- Edited by Srivatsn Narayanan (2/3/2015 10:48:00 AM)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status