-
Notifications
You must be signed in to change notification settings - Fork 363
Add fixer for ClassUsingAttributeInsteadOfInheritanceAnalyzer #588
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
Conversation
|
Hey @Youssef1313, would you have any suggestions on how to handle whitespaces in the code fixer? 😅 |
src/CommunityToolkit.Mvvm.CodeFixers/ClassUsingAttributeInsteadOfInheritanceCodeFixer.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Mvvm.CodeFixers/ClassUsingAttributeInsteadOfInheritanceCodeFixer.cs
Outdated
Show resolved
Hide resolved
Trivia isn't trivial 😄 Given a quick look, I don't see why there is an extra new line. I'll see if I could debug it. |
|
@Sergio0694 The identifier name already has a trailing EndOfLineTrivia, so when you add a base type, the new line remains. You'll have to remove the trivia from the identifier name. But when other interfaces exist, the trailing trivia of identifier name will be a space that you want to keep. Instead of having to handle all that manually, which is hard to get right (for example, you need to keep trailing trivia after identifier name even if there is no existing base list if the user uses K&R braces), you can use |
Use SyntaxGenerator and leave trivia handling up to it
Closes #583
This PR adds a code fixer for
ClassUsingAttributeInsteadOfInheritanceAnalyzer.PR Checklist