roslynator
roslynator copied to clipboard
Proposal: Add analyzer that sorts usings alphabethically
there should be an analyzer that sorts using
s alphabethically.
Optional: usings for System.*
and Microsoft.*
namespaces should come before others.
@JosefPihrt is this something that might make a good community pull request?
For your information, Visual Studio already does this, out of the box:
This will also remove unused usings, but if you don't like that, you can also trigger the sorting as a dedicated action, without the removal (underneath Edit > IntelliSense > Sort Usings).
This will also sort System
namespaces on top (by default, I think), controllable by an option. This can also be configured using .editorconfig
options, and applied via Code Cleanup.
@MovGP0 Is this of use to you? You mentioned specifically an analyzer in this project, so if you're really looking for something like that, then @JosefPihrt is going to be authoritative on that, otherwise these options might be of use to you ;)
I agree that this feature is already available as a part of "code cleanup".
It could be provided as a Roslynator analyzer but it would need to load options from Visual Studio options and .editorconfig options which is not an easy task.