codecadwallader/codemaid

Using statements re-insert does not respect "Preferred 'using' directive placement" setting

Norazan opened this issue · 1 comments

Environment

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

Description

When CodeMaid re-inserts the using statements specified in the settings after a cleanup, it will always place them at the top of the file. Visual Studio has a setting that specifies the preferred 'using' directive placement, for example inside the namespace. It would be nice if CodeMaid can respect this setting.

Steps to recreate

  1. Set the Preferred 'using' directive placement setting to "Inside namespace". This setting can be found in Options -> Text Editor -> C# -> Code Style -> General -> 'using' preferences
  2. In the CodeMaid options under Cleaning -> Visual Studio, add some usings to re-insert when removed.
  3. Create a new C# class and add the usings specified in the previous step (make sure they are unused)
  4. Run a CodeMaid cleanup

Current behavior

The unused usings are re-inserted at the top of the file even though the Preferred 'using' directive placement setting specifies otherwise.

Expected behavior

The unused usings are re-inserted at the location as specified by the Preferred 'using' directive placement setting.

Thanks for the suggestion, I can confirm this is not currently supported.