-
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
Add code action equivalence key validation in test framework #44728
Conversation
@CyrusNajmabadi I will create a separate PR to loosen the de-dupe logic added in #41768 for back compat to allow same provider to register different code actions with different title and same equivalence key. The test framework check added in this PR should help catch our fixers/refactorings from doing so. |
...ditorFeatures/DiagnosticsTestUtilities/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs
Show resolved
Hide resolved
...ditorFeatures/DiagnosticsTestUtilities/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs
Outdated
Show resolved
Hide resolved
src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeFixes/CustomCodeActions.cs
Outdated
Show resolved
Hide resolved
@mavasani For this pull request, I am only expecting changes to equivalence keys for code actions that must change or else they will not work. Changes beyond that can produce subtle changes in the observed behavior which will be difficult to understand during the review. |
…validation until we support FixAll for refactorings
6c6173e
to
6d68dce
Compare
@sharwell @CyrusNajmabadi - I have rebased the PR to add minimal test framework validation:
I will mark the PR for re-review once it is ready. |
It should also only apply to cases that register more than one action. Also, when more than one action is registered, is it a problem for the code fix driver if exactly one of those is null? |
Yes, the current validation only asserts when the fixer has more then one registered code action, such that the code actions use different title, but same equivalence key.
No, the code fix service and fix all work fine for such a case. The validation method doesn't assert for this scenario. |
This PR is now ready for review. @CyrusNajmabadi The only remaining 3 test failures are legitimate failures in Implement interface code fixer, when implementing through a member. I believe the following method needs to be fixed, but I am not sure what is the correct fix. Can you please checkout this PR branch and push a correct fix? Thanks! roslyn/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.CodeAction.cs Lines 142 to 162 in 03c3475
|
I'm much happier with this narrower scoping, particularly in how it clearly reveals the feature(s) that were impacted by this bug. |
I have no idea why implement interface would need a fix-all :-/ but i'll take a look to see if i can figure out waht's going on here. |
It would then be easy to just ensure we pass in false here and the tests should pass: Line 17 in 9625a14
|
👍 |
I'm going to bring the implement interface issue to design meeting today. |
@CyrusNajmabadi there still seems to be a failing test in implement interface. Can you please take a look? |
looking! |
Thanks @CyrusNajmabadi! |
Fixes #44553