Is it possible to sort code via Resharper?
Asked Answered
C

3

10

CodeRush has this nifty plugin called cr_ClassCleaner that allows me to sort the elements in the class (e.g. methods, private variables, etc...).

Can Resharper 5.x do this, either via the product or plugins?

Cacique answered 16/2, 2011 at 17:56 Comment(3)
You'd have to be really careful with a feature like that. If someone use that on a file, while also making some changes, and checked it in, I wouldn't be able to tell what they did to the code. Sounds dangerous.Thormora
Yes it can. Also, if you like coding style plugins check this: stylecopforresharper.codeplex.comKandykane
generally resorting code is a dangerous thingBinky
M
11

Yes - ReSharper, Tools, Cleanup Code.

They recently blogged about customising the type layout this generates.

Microsporophyll answered 16/2, 2011 at 18:0 Comment(0)
T
4

There is an option in code cleanup to reorder type members. This would be done as part of a full cleanup. If you wanted to only reorder, you could create a cleanup profile that only included that step. You can have multiple cleanup profile.

Torietorii answered 16/2, 2011 at 17:59 Comment(0)
T
3

Ctrl+Alt+F (if you're using the IDEA profile) will take you to the cleanup code menu where you can achieve that.

Tishatishri answered 16/2, 2011 at 18:1 Comment(2)
I am looking at the Cleanup Code dialog, there is an option to reorder code elements. If I proceed with it, it does not sort the methods.Cacique
I don't think it reorders the contents of each group by default, no. But you can configure it to - see Sorting, Grouping and Regions at the bottom of this blog post.Microsporophyll

© 2022 - 2024 — McMap. All rights reserved.