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

New refactoring rename namespace by folder structure #50

Open
martinsura opened this issue Feb 21, 2017 · 7 comments
Open

New refactoring rename namespace by folder structure #50

martinsura opened this issue Feb 21, 2017 · 7 comments

Comments

@martinsura
Copy link

Hello,

Nice extensions. Is here any plan to support rename namespace by folder structure?

Thanks

@josefpihrt
Copy link
Collaborator

This requires access to "default namespace" property, which is not currently supported.

See dotnet/roslyn#3798.

@kieronlanning
Copy link

+1

Can you work it out based on the folder structure, up to the point of hitting a project file, like a .csproj in the case of C#?

It would unblock this feature, and for 90% of cases I'm pretty sure that would work.

@josefpihrt
Copy link
Collaborator

@kieronlanning I'm afraid don't understand your proposal. How do you want to obtain default namespace?

@kieronlanning
Copy link

The default namespace is usually the project name, or in the .csproj it has RootNamespace in a PropertyGroup if it's been overridden.

@josefpihrt
Copy link
Collaborator

That would mean to read and parse csproj file every time a refactoring is computed (every time before it is displayed in the context menu).

@felixhirt
Copy link

According to dotnet/roslyn#31253, it seems the roslyn team is working on this very refactoring (a basic version of it works in VisualStudio 2019 RC). It does not seem as if they are providing a warning for it though (at least not at the moment).

Would it be possible to add an analyzer to Roslynator that provides the warning (If i understand correctly, the default namespace is now exposed in the project system dotnet/roslyn#30998)? The refactoring can be used from Rosyln itself i guess.

@felixhirt
Copy link

Uh, im afraid i was a bit too eager. It seems there is still no way to get the project context from a code analyzer. But maybe the roslyn team will turn the refactoring into an analyzer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants