roslynator icon indicating copy to clipboard operation
roslynator copied to clipboard

Add refactoring to shorten `using`s inside `namespace`

Open las-nsc opened this issue 3 years ago • 0 comments

New Analyser/Code-fix request

When using statements are placed inside a namespace which shares some parent namespaces, it is possible to remove the duplicated parent namespaces from the using statement for example:

namespace Foo.Bar.Bob { }
namespace Foo.Bar.Baz
{
    using Foo.Bar.Bob;
    ...
}

becomes:

namespace Foo.Bar.Bob { }
namespace Foo.Bar.Baz
{
    using Bob;
    ...
}

It would also be nice if there were an analiser/code-fix to move local using declarations inside the namespace (but leave external ones outside) too, but I'm not sure how feasible that is.

las-nsc avatar Oct 07 '21 15:10 las-nsc