feat: NE0001 Fix-All — sequential provider for batch rename/move - #11
Conversation
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #11 +/- ##
==========================================
- Coverage 99.08% 97.71% -1.38%
==========================================
Files 7 10 +3
Lines 328 525 +197
Branches 62 106 +44
==========================================
+ Hits 325 513 +188
- Misses 0 1 +1
- Partials 3 11 +8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Add a custom FixAllProvider for NE0001 that resolves every diagnostic in scope by applying the existing rename/move fixes sequentially on the accumulating solution, re-resolving diagnostics between each step. The default WellKnownFixAllProviders.BatchFixer cannot be used because the fix relies on solution-level operations (WithDocumentName, AddDocument) rather than text edits, and because multiple types in one file would produce overlapping edits that fail to merge. Iterating to a fixed point instead lets a multi-type file's remaining type flip from "move" to "rename" between rounds, and skips the unfixable collision case without failing the batch. - Custom FixAllProvider wired via OneTypePerFileCodeFixProvider.GetFixAllProvider() - Supports Document, Project and Solution scope with deterministic ordering - Integration tests: multi-type files, move-then-rename convergence, project scope, collision skip, no-op, and null-argument guard Closes #10
9df3a60 to
9e64ca9
Compare
Exercise the custom fix-all provider from both the unit and integration flags so its lines are not counted as partials against the patch coverage gate: - Add an AdhocWorkspace-based fix-all runner to the unit suite and mirror the Document/Project scope, convergence, collision-skip, no-op and null-argument scenarios there - Cover the supported-scope enumeration and GetFixAllProvider() wiring in both suites, and the solution-scope no-op path - Drop the unreachable document-null guard in TryFixDocumentAsync (the id is always taken from the current solution's documents)
Summary
Implements a custom
FixAllProviderfor NE0001 so the IDE can offer "Fix all NE0001 in Document/Project/Solution". PreviouslyGetFixAllProvider()returnednull, so every violation had to be fixed one lightbulb at a time.Why not the default batch fixer
WellKnownFixAllProviders.BatchFixercomputes each fix independently against the original document and merges the results as text edits. That fails for NE0001 because:WithDocumentName,AddDocument) that are not text edits and are lost by the batch merge.Design
A solution-scoped provider that iterates to a fixed point:
Tests
End-to-end via a real
AdhocWorkspace(FixAllRunner): multi-type file resolution, move-then-rename convergence, project scope across multiple files, collision skip, a no-op case, and the null-argument guard.Closes #10