Share via


CodeActionWithOptions Class

Definition

A CodeAction that can vary with user specified options. Override one of ComputeOperationsAsync(Object, CancellationToken) or ComputeOperationsAsync(Object, IProgress<CodeAnalysisProgress>, CancellationToken) to actually compute the operations for this action.

public ref class CodeActionWithOptions abstract : Microsoft::CodeAnalysis::CodeActions::CodeAction
public abstract class CodeActionWithOptions : Microsoft.CodeAnalysis.CodeActions.CodeAction
type CodeActionWithOptions = class
    inherit CodeAction
Public MustInherit Class CodeActionWithOptions
Inherits CodeAction
Inheritance
CodeActionWithOptions

Constructors

CodeActionWithOptions()

Properties

EquivalenceKey

Two code actions are treated as equivalent if they have equal non-null EquivalenceKey values and were generated by the same CodeFixProvider or CodeRefactoringProvider.

(Inherited from CodeAction)
IsInlinable

If this code action contains NestedActions, this property provides a hint to hosts as to whether or not it's ok to elide this code action and just present the nested actions instead. When a host already has a lot of top-level actions to show, it should consider not inlining this action, to keep the number of options presented to the user low. However, if there are few options to show to the user, inlining this action could be beneficial as it would allow the user to see and choose one of the nested options with less steps. To create a CodeAction with nested actions, use Create(String, ImmutableArray<CodeAction>, Boolean).

(Inherited from CodeAction)
NestedActions

Child actions contained within this CodeAction. Can be presented in a host to provide more potential solution actions to a particular problem. To create a CodeAction with nested actions, use Create(String, ImmutableArray<CodeAction>, Boolean).

(Inherited from CodeAction)
Priority

Priority of this particular action within a group of other actions. Less relevant actions should override this and specify a lower priority so that more important actions are easily accessible to the user. Returns Default if not overridden.

(Inherited from CodeAction)
Tags

Descriptive tags from WellKnownTags. These tags may influence how the item is displayed.

(Inherited from CodeAction)
Title

A short title describing the action that may appear in a menu.

(Inherited from CodeAction)

Methods

ComputeOperationsAsync(CancellationToken)
ComputeOperationsAsync(IProgress<CodeAnalysisProgress>, CancellationToken)

Override this method if you want to implement a CodeAction subclass that includes custom CodeActionOperation's. Prefer overriding this method over ComputeOperationsAsync(CancellationToken) when computation is long running and progress should be shown to the user.

(Inherited from CodeAction)
ComputeOperationsAsync(Object, CancellationToken)

Override this method to compute the operations that implement this CodeAction.

ComputeOperationsAsync(Object, IProgress<CodeAnalysisProgress>, CancellationToken)

Override this method to compute the operations that implement this CodeAction. Prefer overriding this method over ComputeOperationsAsync(Object, CancellationToken) when computation is long running and progress should be shown to the user.

ComputePreviewOperationsAsync(CancellationToken)

Override this method if you want to implement a CodeAction that has a set of preview operations that are different than the operations produced by ComputeOperationsAsync(IProgress<CodeAnalysisProgress>, CancellationToken).

(Inherited from CodeAction)
ComputePriority()

Computes the CodeActionPriority group this code action should be presented in. Legal values this can be must be between Lowest and High.

(Inherited from CodeAction)
GetChangedDocumentAsync(CancellationToken)

Computes changes for a single document. Override this method if you want to implement a CodeAction subclass that changes a single document. Override GetChangedDocumentAsync(IProgress<CodeAnalysisProgress>, CancellationToken) to report progress progress while computing the operations.

(Inherited from CodeAction)
GetChangedDocumentAsync(IProgress<CodeAnalysisProgress>, CancellationToken)

Computes changes for a single document. Override this method if you want to implement a CodeAction subclass that changes a single document. Prefer overriding this method over GetChangedDocumentAsync(CancellationToken) when computation is long running and progress should be shown to the user.

(Inherited from CodeAction)
GetChangedSolutionAsync(CancellationToken)

Computes all changes for an entire solution. Override this method if you want to implement a CodeAction subclass that changes more than one document. Override GetChangedSolutionAsync(IProgress<CodeAnalysisProgress>, CancellationToken) to report progress progress while computing the operations.

(Inherited from CodeAction)
GetChangedSolutionAsync(IProgress<CodeAnalysisProgress>, CancellationToken)

Computes all changes for an entire solution. Override this method if you want to implement a CodeAction subclass that changes more than one document. Prefer overriding this method over GetChangedSolutionAsync(CancellationToken) when computation is long running and progress should be shown to the user.

(Inherited from CodeAction)
GetOperationsAsync(CancellationToken)

The sequence of operations that define the code action.

(Inherited from CodeAction)
GetOperationsAsync(Object, CancellationToken)

Gets the CodeActionOperation's for this CodeAction given the specified options.

GetOperationsAsync(Solution, IProgress<CodeAnalysisProgress>, CancellationToken)

The sequence of operations that define the code action.

(Inherited from CodeAction)
GetOptions(CancellationToken)

Gets the options to use with this code action. This method is guaranteed to be called on the UI thread.

GetPreviewOperationsAsync(CancellationToken)

The sequence of operations used to construct a preview.

(Inherited from CodeAction)
PostProcessAsync(IEnumerable<CodeActionOperation>, CancellationToken)

Apply post processing steps to any ApplyChangesOperation's.

(Inherited from CodeAction)
PostProcessChangesAsync(Document, CancellationToken)

Apply post processing steps to a single document: Reducing nodes annotated with Annotation Formatting nodes annotated with Annotation

(Inherited from CodeAction)
PostProcessChangesAsync(Solution, CancellationToken)

Apply post processing steps to solution changes, like formatting and simplification.

(Inherited from CodeAction)

Applies to