-
Notifications
You must be signed in to change notification settings - Fork 280
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
Fix namespace for current document #5
Comments
I have been trying to work this issue, but I do not yet know where to start, as I can't seem to find the Default Namespace setting in the Roslyn APIs. I will follow up with the C# team, if I find something about it I will continue. @ElemarJR @viniciushana @carloscds any idea on how to move this forward? |
I think that is not wasy to solve this, because Namespace can be anything, not properly a list of files. |
This should be co-implemented with an alternative code fix to move the file to the correct location reflecting the namespace. This feature is closely related to DotNetAnalyzers/Proposals#13. |
@carloscds told me he is working on it now. He said he solved the file location problem. I can't wait to see it. |
@giggio Now it´s working, but I need help to write test. Maybe we need to change some tests methods. |
I am reopening the issue, as we still need to progress on the issue. Also, see PR #38. |
We still have work to do here, one idea may be to watch the csproj/kproj and get the information from there. Not giving up on this one yet. |
We can use |
@giggio System.IO is partially support by PCL. I have a complete code for this, but when I put into analyzer, my code breaks because PCL doesn't implement System.IO.Directory |
We would need to read a file, parse it, and find the default namespace. If we can add a |
You need read file and find RootNameSpace. As I tell, I have create this code that get some source file in project identity your csproj (check if this source is part of this csproj) and after this get RootNamespace. I'm curious about how FileSysteWatcher can identity correct csproj file in a complex solution. |
If a file is located at:
$solutionDir\$projectDir\Folder1\Folder2\file.cs
And the root namespace is
Project
then the namespace for the file should beProject.Folder1.Folder2
.The text was updated successfully, but these errors were encountered: