Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring suggestion: remove using #72991

Open
miloush opened this issue Apr 12, 2024 · 0 comments
Open

Refactoring suggestion: remove using #72991

miloush opened this issue Apr 12, 2024 · 0 comments
Labels
Area-IDE Feature Request untriaged Issues and PRs which have not yet been triaged by a lead

Comments

@miloush
Copy link

miloush commented Apr 12, 2024

Summary

This is a proposal to introduce a refactoring to remove using, i.e. all the types from the used namespace would get fully qualified (or as needed regarding to other imported namespaces).

Background and Motivation

Namespaces refactoring can lead to this operation. Another use case is trying to use a type conflicting with one currently used but from different namespace. You cannot use both namespaces but you don't want to favoritize any.

Proposed Feature

Setup:

namespace MyNamespace.Area1 { class MyClass {} }
namespace MyNamespace.Area2 { class MyClass {} }

Before refactoring:

using MyNamespace.Area1;

namespace MyNamespace
{
    class Foo : MyClass { }
}

After refactoring to remove using MyNamespace.Area1:

namespace MyNamespace
{
    class Foo : Area1.MyClass { }
}

Now class Boo : Area2.MyClass can be added without conflict.

Note that this is difficult to do manually because "fully qualify" quick fix cannot be applied file-wise.

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Issues and PRs which have not yet been triaged by a lead label Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Feature Request untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

No branches or pull requests

1 participant