roslyn
roslyn copied to clipboard
An easier way to execute 'Wrap every parameter -> Indent all parameters'
This issue has been moved from a ticket on Developer Community.
Say I have the following method
public Task HandleAsync(ActivityCreated domainEvent, CancellationToken cancellationToken)
{
throw new System.NotImplementedException();
}
But I wish to reformat it like this (indent all parameters):
public Task HandleAsync(
ActivityCreated domainEvent,
CancellationToken cancellationToken)
{
throw new System.NotImplementedException();
}
I know I can move my cursor to any of the param names and enter Ctrl + . to select the option, but it would be nice to have a faster shortcut to do this, or some way of configuring VS to do this wrap/indent automatically after using Ctrl + . do auto implement some interface method
Original Comments
Feedback Bot on 2/16/2022, 10:59 PM:
Thank you for taking the time to provide your suggestion. We will do some preliminary checks to make sure we can proceed further. You will hear from us in about a week on our next steps.
cc @CyrusNajmabadi
Let's have this implemented... :D
Original post @ StackOverflow: https://stackoverflow.com/q/71136991/114029
I would love that one as well.
To have the possibility to do this refactoring on whole project or solution. It would make life so much easier.
Or ability to do it automatically on save would be even better
+1
We would take a PR that updated the existing refactoring and added fix-all support for it. If any interested parties here would like to contribute that, that would be great.
Please implement.
@halonzo7 if you're interested in contributing a PR to help implement this, we'd be very happy to work with you on it :)
@halonzo7 if you're interested in contributing a PR to help implement this, we'd be very happy to work with you on it :)
Tell me how to get started, would be interested in helping.
Teh wrapping code is implemented as a refactoring here: https://github.com/dotnet/roslyn/blob/main/src/Features/Core/Portable/Wrapping/AbstractWrappingCodeRefactoringProvider.cs
(with vb and c# specific subclasses as this is a cross language feature).
CodeRefactoringProviders support the concept of 'Fix All' which can be provided by overriding this method: https://github.com/dotnet/roslyn/blob/8675c16d105cc816ab368b2276ff14325aa2fb2d/src/Workspaces/Core/Portable/CodeRefactorings/CodeRefactoringProvider.cs#L30
You'd then have the refactoring do the work accordingly on the scope the user wanted.
Is it possible to assign a shortcut to that refactoring?
Any updates to this issue? I also want this feature to be executable by a keyboard shortcut.
@ClassyCircuit the issue remains on the backlog. We'd likely take a good pr here though from the community if anyone is interested.
It would be great if this could be added to the existing Code Style preferences, so it can then be included in the Code Cleanup functionality.
It would be very useful indeed, rather than using AutoHotKey...
Surprised that we have this feature implemented for C# but not C++
@dev-dakky The maintainers of this repository have no impact on the C++ features, and it's unlikely they will see your comment here. I would recommend filing a feedback using the Suggest a feature tool in Visual Studio.
First of all I'm glad there are more folks looking for this feature 🎆 Second of all I have a whole team waiting for this feature :) Many upvotes!
Ping! 😄 Would be nice to have it in the Code Cleanup :) as well as 'Add Argument Names'
Ping! 😄 Would be nice to have it in the Code Cleanup :) as well as 'Add Argument Names'
@alikleit as stated above: the issue remains on the backlog. We'd likely take a good pr here though from the community if anyone is interested.
You can use the extension CodeRush!
I'd love this feature!