/// <summary> /// If the provided fix all context is non-null and the context's code action Id matches the given code action's Id then, /// returns the set of fix all occurrences actions associated with the code action. /// </summary> internal static SuggestedActionSet GetFixAllSuggestedActionSet( CodeAction action, int actionCount, FixAllCodeActionContext fixAllCodeActionContext, Workspace workspace, ITextBuffer subjectBuffer, ICodeActionEditHandlerService editHandler, IWaitIndicator waitIndicator) { if (fixAllCodeActionContext == null) { return(null); } if (actionCount > 1 && action.EquivalenceKey == null) { return(null); } var fixAllSuggestedActions = ImmutableArray.CreateBuilder <FixAllSuggestedAction>(); foreach (var scope in fixAllCodeActionContext.SupportedScopes) { var fixAllContext = fixAllCodeActionContext.GetContextForScopeAndActionId(scope, action.EquivalenceKey); var fixAllAction = new FixAllCodeAction(fixAllContext, fixAllCodeActionContext.FixAllProvider, showPreviewChangesDialog: true); var fixAllSuggestedAction = new FixAllSuggestedAction(workspace, subjectBuffer, editHandler, waitIndicator, fixAllAction, fixAllCodeActionContext.FixAllProvider, fixAllCodeActionContext.OriginalDiagnostics.First()); fixAllSuggestedActions.Add(fixAllSuggestedAction); } return(new SuggestedActionSet(fixAllSuggestedActions.ToImmutable(), title: EditorFeaturesResources.FixAllOccurrencesIn)); }
internal FixAllSuggestedAction( Workspace workspace, ITextBuffer subjectBuffer, ICodeActionEditHandlerService editHandler, FixAllCodeAction codeAction, FixAllProvider provider, Diagnostic originalFixedDiagnostic) : base(workspace, subjectBuffer, editHandler, codeAction, provider) { _fixedDiagnostic = originalFixedDiagnostic; }
internal FixAllSuggestedAction( Workspace workspace, ITextBuffer subjectBuffer, ICodeActionEditHandlerService editHandler, IWaitIndicator waitIndicator, FixAllCodeAction codeAction, FixAllProvider provider, Diagnostic originalFixedDiagnostic, IAsynchronousOperationListener operationListener) : base(workspace, subjectBuffer, editHandler, waitIndicator, codeAction, provider, operationListener) { _fixedDiagnostic = originalFixedDiagnostic; }
/// <summary> /// If the provided fix all context is non-null and the context's code action Id matches the given code action's Id then, /// returns the set of fix all occurrences actions associated with the code action. /// </summary> internal static SuggestedActionSet GetFixAllSuggestedActionSet( CodeAction action, int actionCount, FixAllState fixAllState, IEnumerable <FixAllScope> supportedScopes, Diagnostic firstDiagnostic, Workspace workspace, ITextBuffer subjectBuffer, ICodeActionEditHandlerService editHandler, IWaitIndicator waitIndicator, IAsynchronousOperationListener operationListener) { if (fixAllState == null) { return(null); } if (actionCount > 1 && action.EquivalenceKey == null) { return(null); } var fixAllSuggestedActions = ArrayBuilder <FixAllSuggestedAction> .GetInstance(); foreach (var scope in supportedScopes) { var fixAllStateForScope = fixAllState.WithScopeAndEquivalenceKey(scope, action.EquivalenceKey); var fixAllAction = new FixAllCodeAction(fixAllStateForScope, showPreviewChangesDialog: true); var fixAllSuggestedAction = new FixAllSuggestedAction( workspace, subjectBuffer, editHandler, waitIndicator, fixAllAction, fixAllStateForScope.FixAllProvider, firstDiagnostic, operationListener); fixAllSuggestedActions.Add(fixAllSuggestedAction); } return(new SuggestedActionSet( fixAllSuggestedActions.ToImmutableAndFree(), title: EditorFeaturesResources.Fix_all_occurrences_in)); }