Delen via


FixAllContext Class

Definition

Context for "Fix all occurrences" code fixes provided by a Microsoft.CodeAnalysis.CodeFixes.FixAllContext.FixAllProvider.

public ref class FixAllContext
public class FixAllContext
type FixAllContext = class
Public Class FixAllContext
Inheritance
FixAllContext

Constructors

FixAllContext(Document, CodeFixProvider, FixAllScope, String, IEnumerable<String>, FixAllContext+DiagnosticProvider, CancellationToken)

Creates a new FixAllContext. Use this overload when applying fix all to a diagnostic with a source location.

This overload cannot be used with ContainingMember or ContainingType value for the scope. For those fix all scopes, use the FixAllContext constructor that takes a 'diagnosticSpan' parameter to identify the containing member or type based on this span.

FixAllContext(Document, Nullable<TextSpan>, CodeFixProvider, FixAllScope, String, IEnumerable<String>, FixAllContext+DiagnosticProvider, CancellationToken)

Creates a new FixAllContext with an associated diagnosticSpan. Use this overload when applying fix all to a diagnostic with a source location and using ContainingMember or ContainingType for the scope. When using other fix all scopes, diagnosticSpan is not required and other constructor which does not take a diagnostic span can be used instead.

FixAllContext(Project, CodeFixProvider, FixAllScope, String, IEnumerable<String>, FixAllContext+DiagnosticProvider, CancellationToken)

Creates a new FixAllContext. Use this overload when applying fix all to a diagnostic with no source location, i.e. None.

Properties

CancellationToken

CancellationToken for fix all session.

CodeActionEquivalenceKey

The EquivalenceKey value expected of a CodeAction participating in this fix all.

CodeFixProvider

Underlying CodeFixProvider which triggered this fix all.

DiagnosticIds

Diagnostic Ids to fix. Note that GetDocumentDiagnosticsAsync(Document), GetProjectDiagnosticsAsync(Project) and GetAllDiagnosticsAsync(Project) methods return only diagnostics whose IDs are contained in this set of Ids.

Document

Document within which fix all occurrences was triggered, null if the FixAllContext is scoped to a project.

Progress

Progress sink for reporting the progress of a fix-all operation.

Project

Project within which fix all occurrences was triggered.

Scope

FixAllScope to fix all occurrences.

Solution

Solution to fix all occurrences.

Methods

GetAllDiagnosticsAsync(Project)

Gets all the diagnostics in the given project filtered by DiagnosticIds. This includes both document-level diagnostics for all documents in the given project and project-level diagnostics, i.e. diagnostics with no source location, in the given project.

GetDocumentDiagnosticsAsync(Document)

Gets all the diagnostics in the given document filtered by DiagnosticIds.

GetProjectDiagnosticsAsync(Project)

Gets all the project-level diagnostics, i.e. diagnostics with no source location, in the given project filtered by DiagnosticIds.

WithCancellationToken(CancellationToken)

Gets a new FixAllContext with the given cancellationToken.

Applies to