Open martinsura opened 7 years ago
This requires access to "default namespace" property, which is not currently supported.
+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.
@kieronlanning I'm afraid don't understand your proposal. How do you want to obtain default namespace?
The default namespace is usually the project name, or in the .csproj it has RootNamespace
in a PropertyGroup
if it's been overridden.
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).
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.
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
Hello,
Nice extensions. Is here any plan to support rename namespace by folder structure?
Thanks