User story 862192: FixAllProvider API and default fix all implementations (replace "Fix All Occurrences")
Changes include:
1) Add a new abstract type, FixAllProvider, in Workspaces layer to represent a provider which can provide "fix all occurrences" code fixes corresponding to fixes provided by an ICodeFixProvider.
2) Add a new API on ICodeFixProvider (GetFixAllProvider()) to get an optional FixAllProvider. Implementers can return null to indicate no fix all support. Otherwise, they can either return an instance any of the well known implementations (see (3) below) or return an instance of their own implementation of FixAllProvider.
3) Provide default implementation of a batch FixAllProvider which works for simple code fix providers which return code actions which have a single document change action. This provider batches all the individual diagnostic fixes across the scope of fix all action, computes fixes in parallel and and then merges all the non-conflicting fixes into a single fix all code action. For more complex scenarios, users must write their own FixAllProvider implementation.
4) Add the following public types for FixAllProvider:
(a) FixAllScope: Represents the scope in which fix all occurrences will be applied (document/project/solution/custom)
(b) FixAllContext: Context information for computing fix all fixes. This context object is passed into FixAllProvider.GetFix API.
5) Add an optional string property "Id" on CodeAction. This string defines a unique Id amongst all code actions returned by an ICodeFixProvider, and is part of the FixAllContext to determine which code action is applied at all fix locations.
6) Enable fix all support for following code fixes:
(a) Simplify type names
(b) Remove unnecessary cast
(c) Remove unncessary usings
(d) Implement interface/abstract type
7) Fix All Occurrences UI: Currently, these FixAllOccurrences code fixes will show up as hyperlinks in code fix preview pane. Clicking on these will trigger computation of diagnostics and fix all fixes for the chosen scope. Subsequently, preview changes dialog will come up to preview the fix.
Post preview, these hyperlinks will be replaced with lightbulb sub menus under the original code fix. (changeset 1341442)
↧