-
Notifications
You must be signed in to change notification settings - Fork 1
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
Move type to "correct" file #13
Comments
yes, yes, yes! I want this! |
A few questions and thoughts I have for this:
|
For this refactoring, it would make sense to place the file in the same folder as the source file it was extracted from. A separate refactoring could be implemented for moving a file to a new folder based on the namespace of the type it contains. |
I know this feature from ReSharper, I love it, and that's why I would like to take that one. Creating and transfering a repository seems to be not that easy, so I suggest you create one under DotNetAnalysers. Should this be a diagnostic or a refactoring? I thought of naming it either TypeToFile[Diagnostic|Refactoring], TypeNameToFileName[Diagnostic|Refactoring], ExtractTypeToFile[Diagnostic|Refactoring] or ExtractType[Diagnostic|Refactoring], but I would hope that you or anyone else has some better ideas, because none of the above exactly matches your description. |
It's pretty easy to move; that was just the first time i tried to move someone else's repository. I wouldn't let that stop you, especially since I'm not available to create a new one here until next week. |
Ahh ok, I've never done that before. It doesn't stop me, no worries :-), I always have my local repo. |
Cool. I look forward to seeing it! 👍 |
Ok, so this project is currently hosted here and of course everyone is invited to contribute. |
@eggapauli, I believe you forgot to remove the |
Oh you are right, thanks. I used this as a template, because I'm new to the Roslyn API. |
I propose a refactoring analyzer which is capable of handling two situations.
A single top-level type is defined in a file which does not match the name of the class
This refactoring would rename the file to match the metadata name of the type it contains. For non-generic types, this is just the simple name of the type. For generic types, this is the simple name for the type followed by a
`
and then the generic arity.Multiple top-level types are defined in a file
For the type, if any, which matches the name of the file, no refactoring is proposed. For other types defined in the file, the refactoring would move the type to its own file based on the name of the type.
It would also be possible to create a diagnostic for these situations, which is applicable to projects where the situation should be proactively avoided.
The text was updated successfully, but these errors were encountered: