dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
18.91k stars 4.01k forks source link

"Change signature" refactoring moves non-argument tokens of multi-line method invocations #4128

Open SolalPirelli opened 9 years ago

SolalPirelli commented 9 years ago

A minor but somewhat annoying bug that hit me today.


Repro: In VS2015 RTM, declare the following method:

void M( int a, int b ) { }

And use it in a multi-line invocation:

M(
    1,
    2
);

Use the "Change signature" quick action on M, and swap the parameters order.

Expected result:

M(
    2,
    1
);

Actual result:

M(
    2
,
    1 );

FWIW, VS 2013 moves all the parameters on one line, i.e. M( 2, 1 );. This is not desirable either, since it may result in very long lines.

dpoeschl commented 9 years ago

Thanks for filing this. /cc: @brettfo as FYI because it's related to something he's been working on.

brettfo commented 9 years ago

This should work when #1017 is fixed.