-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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 'invert if' refactor to properly enclose #region/#endregion blocks #74145
Fix 'invert if' refactor to properly enclose #region/#endregion blocks #74145
Conversation
src/Features/Core/Portable/InvertIf/AbstractInvertIfCodeRefactoringProvider.cs
Outdated
Show resolved
Hide resolved
} | ||
} | ||
"""); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you have a test where the parent scope is a case
block in a switch?
also a test where we're inverting an if-statement as a top level statement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the switch case test 😃.
I also checked for the top level if-statement but the refactor is not suggested. Am i missing something?
This looks good. Just would like some extra tests. Thanks! |
Thanks for the review @CyrusNajmabadi 😄. I'll follow your suggestions ASAP. |
Thanks! |
PR Description
Fixes #73917
Context:
While this fix targets a specific case (InvertIfStyle.IfWithoutElse_MoveSubsequentStatementsToIfBody) of GetRootWithInvertIfStatement(), it's likely that similar issues exist in other cases within this method. As I'm new to the repository i wanted to start with this specific case to ensure the approach is correct before making broader changes.