Conversation
|
I rebased a few improvements ans bug fixes |
|
I'm not merging this for now because I'd like to see this issue resolved. I'll post some additional comments in the code regarding less important "tweaks" that I would have just done myself during the merge, in case you want to fix them. ❗ This diagnostic uses private Diagnostic CreateDiagnostic(ParenthesizedExpressionSyntax syntax)
{
Location primaryLocation = syntax.OpenParenToken.GetLocation();
Location[] secondaryLocations = { syntax.CloseParenToken.GetLocation() };
return Diagnostic.Create(Descriptor, primaryLocation, additionalLocations: secondaryLocations);
}Unfortunately this did not have the expected result. Instead, I believe you will need to do the following:
|
There was a problem hiding this comment.
These blank lines are getting inserted due to a bug in the Remove and Sort Usings feature in Visual Studio 2015 preview. After running this command, you should look at the result and see if it added the extra lines.
|
I believe that is a more accurate representation. However, if you want to do even more (shouldn't be much more than you just did), you could do the following:
I believe you will like the UI of this much more, and the only work is step 3.i. You also have to handle steps 2 and 3.iii above, but those are trivial. |
|
I will do that. Actually it is not as trivial because I have to change a lot of unit tests too |
|
❓ I thought you shouldn't need to change the tests, because the first character of the location where the SA1119 diagnostic is reported stays the same. |
|
But the diagnostic now reports 3 diagnostics. 2 start at the same position but they are different and one is at the closing parenthesis |
|
😦 Sorry about that. Do you agree this is the right approach for the user experience? |
|
Done. |
|
Unfortunately I'm out of time today 😞 , but it shouldn't take me too long to review this again when I have more time. 👍 |
Fixes #88.
This is a very tricky one. I tried it on Json.Net. It found a lot of violations but they all seem correct. The Code Fix was able to fix them all at once.
I am mostly compatible with StyleCop I think except for the one thing mentioned in #88. because of readability I don't report diagnostics for parenthised expressions in BinaryExpresions.