codemaid icon indicating copy to clipboard operation
codemaid copied to clipboard

Usings sort incorrectly

Open bvbellomo opened this issue 3 years ago • 3 comments

Environment

  • Visual Studio version: 2022 Enterprise
  • CodeMaid version: 12.0
  • Code language: C#

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

bvbellomo avatar May 06 '22 17:05 bvbellomo

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.

codecadwallader avatar May 10 '22 11:05 codecadwallader

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

Codemaid -> Sort Lines sorts correctly.

Probably a VS bug.

bvbellomo avatar May 10 '22 17:05 bvbellomo

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.

codecadwallader avatar May 17 '22 12:05 codecadwallader