codecadwallader / codemaid

CodeMaid is an open source Visual Studio extension to cleanup and simplify our C#, C++, F#, VB, PHP, PowerShell, JSON, XAML, XML, ASP, HTML, CSS, LESS, SCSS, JavaScript and TypeScript coding.
http://www.codemaid.net
GNU Lesser General Public License v3.0
1.89k stars 356 forks source link

Usings sort incorrectly #924

Open bvbellomo opened 2 years ago

bvbellomo commented 2 years ago

Environment

Description

In earlier versions of Visual Studio, CodeMaid respected Visual Studio's option of how to sort usings, either putting "System" first or sorting all usings alphabetically. My CodeMaid in VS 2022 however always puts System first, despite my Visual Studio preferences being set to sort all usings alphabetically. My coworkers also have this issue (same software, different machines).

Steps to recreate

Uncheck Options>Text Editor>C#>Advanced>Place 'System' directives first when sorting usings. Run codemaid on a C# file.

Current behavior

'System' directives are placed first

Expected behavior

'System' directives should be sorted alphabetically

codecadwallader commented 2 years ago

Thanks for reporting the issue. I have been unable to reproduce it. If you right click on the open document and select "Remove and Sort Usings" do you see the same behavior?

CodeMaid simply invokes the underlying Visual Studio command in later Visual Studio versions like VS2022 now that it is a native capability.

bvbellomo commented 2 years ago

"Remove and Sort Usings" puts "System" first.

Codemaid -> Sort Lines sorts correctly.

Probably a VS bug.

codecadwallader commented 2 years ago

Ok, thanks for confirming. It may be helpful to report it to Microsoft using the "Send Feedback" button in the top-right corner of Visual Studio.