Optimize imports / add reference: option to put using directives inside namespace

Answered

When I press Ctrl+Alt+O to optimize imports or add a not-yet-used reference via Alt+Enter, Rider puts the `using` directive outside of the namespace, while our team agreed upon putting the `using` directives inside the namespace (which is forced by StyleCop).

Request: an option switch that makes the import organizer put the using directives either inside or outside the namespace.

This functionality was available in ReSharper:
http://stackoverflow.com/questions/820795/visual-studio-or-resharper-functionality-for-placement-of-using-directives 

0
4 comments
Avatar
Permanently deleted user

This would be much appreciated, along with StyleCop support in general. For me its making the difference between a license purchase or sticking with VS for now.

0

Hey,

Thanks for your feedback. There is a setting for putting the `using` directive inside the namespace in Rider, just like in ReSharper:

``File | Settings | Editor | Code Style | C# | Code Style | Reference Qualification | Add 'using' directive to deepest scope``

As for the StyleCop support, we have made some improvements in this area in Rider 2018.1, see https://youtrack.jetbrains.com/issue/RIDER-656#comment=27-2815424

Hope this helps.

2
Avatar
Permanently deleted user

I cannot see it in the latest Rider version:

0

Hey @Alexey the option is under

Settings -> Code Editor -> C# -> Code Style ->  Reference Qualification and 'using' Directives | Add 'using' directive to deepest scope

Rider version 2019.2.2

3

Please sign in to leave a comment.