31 types derived from CodeAction
Microsoft.AspNetCore.Mvc.Api.Analyzers (2)
AddResponseTypeAttributeCodeFixAction.cs (1)
30internal sealed class AddResponseTypeAttributeCodeFixAction : CodeAction
ApiActionsDoNotRequireExplicitModelValidationCodeFixProvider.cs (1)
37private sealed class MyCodeAction : CodeAction
Microsoft.CodeAnalysis.CodeStyle.Fixes (5)
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.AbstractCodeAction.cs (1)
25private abstract class AbstractCodeAction : CodeAction
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.CodeAction.cs (1)
18private sealed partial class GenerateParameterizedMemberCodeAction : CodeAction
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.CodeAction.cs (1)
28private sealed partial class GenerateVariableCodeAction : CodeAction
src\Analyzers\Core\CodeFixes\NamingStyle\NamingStyleCodeFixProvider.cs (1)
111private sealed class FixNameCodeAction : CodeAction
src\Analyzers\Core\CodeFixes\UpgradeProject\AbstractUpgradeProjectCodeFixProvider.cs (1)
99internal sealed class ProjectOptionsChangeAction : CodeAction
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (3)
CodeActions\ApplyChangesOperationTests.cs (1)
41private sealed class TestCodeAction : CodeAction
CodeActions\Preview\ErrorCases\ExceptionInCodeAction.cs (1)
24internal sealed class ExceptionCodeAction : CodeAction
CodeActions\PreviewTests.cs (1)
52private class TestCodeAction : CodeAction
Microsoft.CodeAnalysis.EditorFeatures (1)
RenameTracking\RenameTrackingTaggerProvider.RenameTrackingCodeAction.cs (1)
24private sealed class RenameTrackingCodeAction : CodeAction
Microsoft.CodeAnalysis.EditorFeatures.Wpf (1)
Suggestions\PreviewChanges\PreviewChangesCodeAction.cs (1)
18private sealed class PreviewChangesCodeAction : CodeAction
Microsoft.CodeAnalysis.Features (10)
AddImport\CodeActions\AddImportCodeAction.cs (1)
22internal abstract class AddImportCodeAction : CodeAction
CodeFixes\Suppression\NestedSuppressionCodeAction.cs (1)
11internal abstract class NestedSuppressionCodeAction : CodeAction
CodeFixesAndRefactorings\AbstractFixAllCodeAction.cs (1)
19internal abstract class AbstractFixAllCodeAction : CodeAction
CodeRefactorings\MoveType\AbstractMoveTypeService.MoveTypeCodeAction.cs (1)
18private sealed class MoveTypeCodeAction : CodeAction
GenerateType\AbstractGenerateTypeService.CodeAction.cs (1)
22private sealed class GenerateTypeCodeAction : CodeAction
IntroduceVariable\AbstractIntroduceVariableService.AbstractIntroduceVariableCodeAction.cs (1)
19private abstract class AbstractIntroduceVariableCodeAction : CodeAction
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.AbstractCodeAction.cs (1)
25private abstract class AbstractCodeAction : CodeAction
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.CodeAction.cs (1)
18private sealed partial class GenerateParameterizedMemberCodeAction : CodeAction
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.CodeAction.cs (1)
28private sealed partial class GenerateVariableCodeAction : CodeAction
src\Analyzers\Core\CodeFixes\NamingStyle\NamingStyleCodeFixProvider.cs (1)
111private sealed class FixNameCodeAction : CodeAction
Microsoft.CodeAnalysis.VisualBasic.Features (8)
CodeFixes\CorrectNextControlVariable\CorrectNextControlVariableCodeFixProvider.CodeAction.vb (1)
11Inherits CodeAction
CodeFixes\GenerateEvent\GenerateEventCodeFixProvider.CodeAction.vb (1)
12Inherits CodeAction
CodeFixes\IncorrectExitContinue\IncorrectExitContinueCodeFixProvider.AddKeywordCodeAction.vb (1)
13Inherits CodeAction
CodeFixes\IncorrectExitContinue\IncorrectExitContinueCodeFixProvider.ReplaceKeywordCodeAction.vb (1)
13Inherits CodeAction
CodeFixes\IncorrectExitContinue\IncorrectExitContinueCodeFixProvider.ReplaceTokenKeywordCodeAction.vb (1)
12Inherits CodeAction
CodeFixes\MoveToTopOfFile\MoveToTopOfFileCodeFixProvider.MoveToLineCodeAction.vb (1)
12Inherits CodeAction
CodeFixes\OverloadBase\OverloadBaseCodeFixProvider.AddKeywordAction.vb (1)
17Inherits CodeAction
CodeRefactorings\RemoveStatementCodeAction.vb (1)
11Inherits CodeAction
Microsoft.CodeAnalysis.Workspaces (1)
CodeActions\CodeActionWithOptions.cs (1)
19public abstract class CodeActionWithOptions : CodeAction
1105 references to CodeAction
AnalyzerRunner (2)
CodeRefactoringRunner.cs (2)
88var codeActions = new List<CodeAction>(); 92foreach (var codeAction in codeActions)
BuildActionTelemetryTable (1)
Program.cs (1)
488static bool isCodeActionType(Type t) => typeof(CodeAction).IsAssignableFrom(t);
ILLink.CodeFixProvider (2)
BaseAttributeCodeFixProvider.cs (1)
46 context.RegisterCodeFix (CodeAction.Create (
DynamicallyAccessedMembersCodeFixProvider.cs (1)
108 context.RegisterCodeFix (CodeAction.Create (
Microsoft.Analyzers.Extra (3)
CallAnalysis\Fixers\LegacyLoggingFixer.cs (1)
62CodeAction.Create(
MakeExeTypesInternalFixer.cs (2)
32var action = CodeAction.Create(Resources.MakeTypeInternal, c => MakeInternalAsync(context.Document, node, context.CancellationToken), nameof(MakeExeTypesInternalFixer));
Microsoft.Analyzers.Extra.Tests (2)
Resources\RoslynTestUtils.cs (2)
342var actions = new List<CodeAction>(); 451var fixAllCodeAction = await fixAllProvider!.GetFixAsync(context);
Microsoft.Analyzers.Local.Tests (2)
Resources\RoslynTestUtils.cs (2)
343var actions = new List<CodeAction>(); 452var fixAllCodeAction = await fixAllProvider!.GetFixAsync(context);
Microsoft.AspNetCore.Analyzer.Testing (2)
CodeFixRunner.cs (2)
28var actions = new List<CodeAction>(); 61private static async Task<Solution> ApplyFixAsync(CodeAction codeAction)
Microsoft.AspNetCore.App.Analyzers.Test (2)
Dependencies\AddPackageTests.cs (2)
72internal override Task<CodeAction> TryCreateCodeActionAsync( 80return Task.FromResult<CodeAction>(null);
Microsoft.AspNetCore.App.CodeFixes (11)
Authorization\AddAuthorizationBuilderFixer.cs (1)
47CodeAction.Create(title,
Dependencies\AddPackageFixer.cs (2)
89var codeAction = await TryCreateCodeActionAsync( 112internal virtual async Task<CodeAction?> TryCreateCodeActionAsync(
DetectMismatchedParameterOptionalityFixer.cs (1)
28CodeAction.Create("Fix mismatched route parameter and argument optionality",
Http\HeaderDictionaryAddFixer.cs (2)
50CodeAction.Create(appendTitle, 60CodeAction.Create(indexerTitle,
Http\HeaderDictionaryIndexerFixer.cs (1)
32CodeAction.Create(title,
Kestrel\ListenOnIPv6AnyFixer.cs (1)
29CodeAction.Create(
PublicPartialProgramClassFixer.cs (1)
28CodeAction.Create("Remove unnecessary public partial class Program declaration",
RouteParameterUnusedParameterFixer.cs (1)
50CodeAction.Create($"Add parameter '{routeParameterName}'",
WebApplicationBuilderFixer.cs (1)
68CodeAction.Create(
Microsoft.AspNetCore.Components.Analyzers (1)
ComponentParametersShouldBePublicCodeFixProvider.cs (1)
43CodeAction.Create(
Microsoft.AspNetCore.Components.Analyzers.Tests (2)
Helpers\CodeFixVerifier.Helper.cs (1)
26private static Document ApplyFix(Document document, CodeAction codeAction)
Verifiers\CodeFixVerifier.cs (1)
85var actions = new List<CodeAction>();
Microsoft.AspNetCore.Components.SdkAnalyzers (1)
ComponentParametersShouldBePublicCodeFixProvider.cs (1)
43CodeAction.Create(
Microsoft.AspNetCore.Components.SdkAnalyzers.Tests (2)
Helpers\CodeFixVerifier.Helper.cs (1)
26private static Document ApplyFix(Document document, CodeAction codeAction)
Verifiers\CodeFixVerifier.cs (1)
85var actions = new List<CodeAction>();
Microsoft.AspNetCore.Mvc.Api.Analyzers (1)
AddResponseTypeAttributeCodeFixAction.cs (1)
20/// A <see cref="CodeAction"/> that adds one or more <c>ProducesResponseType</c> attributes on the action.
Microsoft.CodeAnalysis.CodeStyle.Fixes (94)
src\Analyzers\Core\CodeFixes\AddAnonymousTypeMemberName\AbstractAddAnonymousTypeMemberNameCodeFixProvider.cs (1)
46CodeAction.Create(
src\Analyzers\Core\CodeFixes\AddExplicitCast\AbstractAddExplicitCastCodeFixProvider.cs (3)
89using var actions = TemporaryArray<CodeAction>.Empty; 96actions.Add(CodeAction.Create( 111CodeAction.Create(CodeFixesResources.Add_explicit_cast, actions.ToImmutableAndClear(), isInlinable: false),
src\Analyzers\Core\CodeFixes\AddParameter\AbstractAddParameterCodeFixProvider.cs (12)
246ImmutableArray<CodeAction> NestByOverload() 248var builder = new FixedSizeArrayBuilder<CodeAction>(codeFixData.Length); 253var codeAction = CodeAction.Create( 264codeAction = CodeAction.Create( 268CodeAction.Create( 283ImmutableArray<CodeAction> NestByCascading() 285using var builder = TemporaryArray<CodeAction>.Empty; 290return CodeAction.Create(title, data.CreateChangedSolutionNonCascading, equivalenceKey: title); 298return CodeAction.Create(title, data.CreateChangedSolutionCascading!, equivalenceKey: title); 306builder.Add(CodeAction.Create(nestedNonCascadingTitle, nonCascadingActions, isInlinable: false)); 313builder.Add(CodeAction.Create(nestedCascadingTitle, cascadingActions, isInlinable: false));
src\Analyzers\Core\CodeFixes\AddRequiredParentheses\AddRequiredParenthesesCodeFixProvider.cs (1)
34CodeAction.Create(
src\Analyzers\Core\CodeFixes\AliasAmbiguousType\AbstractAliasAmbiguousTypeCodeFixProvider.cs (3)
53using var _ = ArrayBuilder<CodeAction>.GetInstance(out var actions); 59actions.Add(CodeAction.Create( 71CodeAction.Create(
src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (3)
300static CodeAction CreateCodeAction(string title, Func<CancellationToken, Task<Document>> action, string equivalenceKey) 302var codeAction = CodeAction.Create(title, action, equivalenceKey, CodeActionPriority.High);
src\Analyzers\Core\CodeFixes\ConvertToAsync\AbstractConvertToAsyncCodeFixProvider.cs (3)
40var codeAction = await GetCodeActionAsync( 61private async Task<CodeAction> GetCodeActionAsync( 74return CodeAction.Create(
src\Analyzers\Core\CodeFixes\DocumentationComments\AbstractAddDocCommentNodesCodeFixProvider.cs (1)
42CodeAction.Create(
src\Analyzers\Core\CodeFixes\DocumentationComments\AbstractRemoveDocCommentNodeCodeFixProvider.cs (1)
41CodeAction.Create(
src\Analyzers\Core\CodeFixes\FileHeaders\AbstractFileHeaderCodeFixProvider.cs (1)
36CodeAction.Create(
src\Analyzers\Core\CodeFixes\Formatting\FormattingCodeFixProvider.cs (2)
45var codeAction = CodeAction.Create(
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.cs (5)
78public async Task<ImmutableArray<CodeAction>> GenerateConstructorAsync(Document document, SyntaxNode node, CancellationToken cancellationToken) 89using var result = TemporaryArray<CodeAction>.Empty; 94result.Add(CodeAction.Create( 103result.Add(CodeAction.Create( 110result.Add(CodeAction.Create(
src\Analyzers\Core\CodeFixes\GenerateConstructor\IGenerateConstructorService.cs (1)
16Task<ImmutableArray<CodeAction>> GenerateConstructorAsync(Document document, SyntaxNode node, CancellationToken cancellationToken);
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.cs (2)
24public async Task<ImmutableArray<CodeAction>> GenerateDefaultConstructorsAsync( 34using var _ = ArrayBuilder<CodeAction>.GetInstance(out var result);
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\IGenerateDefaultConstructorsService.cs (1)
17Task<ImmutableArray<CodeAction>> GenerateDefaultConstructorsAsync(
src\Analyzers\Core\CodeFixes\GenerateEnumMember\AbstractGenerateEnumMemberService.CodeAction.cs (1)
19private sealed partial class GenerateEnumMemberCodeAction(Document document, State state) : CodeAction
src\Analyzers\Core\CodeFixes\GenerateEnumMember\AbstractGenerateEnumMemberService.cs (1)
29public async Task<ImmutableArray<CodeAction>> GenerateEnumMemberAsync(Document document, SyntaxNode node, CancellationToken cancellationToken)
src\Analyzers\Core\CodeFixes\GenerateEnumMember\IGenerateEnumMemberService.cs (1)
15Task<ImmutableArray<CodeAction>> GenerateEnumMemberAsync(Document document, SyntaxNode node, CancellationToken cancellationToken);
src\Analyzers\Core\CodeFixes\GenerateMember\AbstractGenerateMemberCodeFixProvider.cs (1)
27protected abstract Task<ImmutableArray<CodeAction>> GetCodeActionsAsync(Document document, SyntaxNode node, CancellationToken cancellationToken);
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateConversionService.cs (1)
29public async Task<ImmutableArray<CodeAction>> GenerateConversionAsync(
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateDeconstructMethodService.cs (1)
24public async Task<ImmutableArray<CodeAction>> GenerateDeconstructMethodAsync(
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateMethodService.cs (1)
30public async Task<ImmutableArray<CodeAction>> GenerateMethodAsync(
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.cs (2)
42protected async ValueTask<ImmutableArray<CodeAction>> GetActionsAsync(Document document, State state, CancellationToken cancellationToken) 44using var _ = ArrayBuilder<CodeAction>.GetInstance(out var result);
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\IGenerateConversionService.cs (1)
15Task<ImmutableArray<CodeAction>> GenerateConversionAsync(Document document, SyntaxNode node, CancellationToken cancellationToken);
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\IGenerateDeconstructMemberService.cs (1)
16Task<ImmutableArray<CodeAction>> GenerateDeconstructMethodAsync(
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\IGenerateParameterizedMemberService.cs (1)
16Task<ImmutableArray<CodeAction>> GenerateMethodAsync(Document document, SyntaxNode node, CancellationToken cancellationToken);
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.cs (9)
39public async Task<ImmutableArray<CodeAction>> GenerateVariableAsync( 54using var _ = ArrayBuilder<CodeAction>.GetInstance(out var actions); 82return [CodeAction.Create( 96ArrayBuilder<CodeAction> result, SemanticDocument document, State state, CancellationToken cancellationToken) 139private static void GenerateWritableProperty(ArrayBuilder<CodeAction> result, SemanticDocument document, State state) 146private static void AddFieldCodeActions(ArrayBuilder<CodeAction> result, SemanticDocument document, State state) 178private static void GenerateWriteableField(ArrayBuilder<CodeAction> result, SemanticDocument document, State state) 185ArrayBuilder<CodeAction> result, Document document, State state, CancellationToken cancellationToken) 201ArrayBuilder<CodeAction> result, Document document, State state, CancellationToken cancellationToken)
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.GenerateLocalCodeAction.cs (1)
21private sealed class GenerateLocalCodeAction(TService service, Document document, State state) : CodeAction
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.GenerateParameterCodeAction.cs (1)
16private sealed class GenerateParameterCodeAction(Document document, State state, bool includeOverridesAndImplementations, int parameterIndex) : CodeAction
src\Analyzers\Core\CodeFixes\GenerateVariable\IGenerateVariableService.cs (1)
17Task<ImmutableArray<CodeAction>> GenerateVariableAsync(Document document, SyntaxNode node, CancellationToken cancellationToken);
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\AbstractImplementAbstractClassCodeFixProvider.cs (2)
50CodeAction.Create( 64CodeAction.Create(
src\Analyzers\Core\CodeFixes\ImplementInterface\AbstractImplementInterfaceCodeFixProvider.cs (2)
53using var _ = ArrayBuilder<CodeAction>.GetInstance(out var codeActions); 58codeActions.Add(CodeAction.Create(
src\Analyzers\Core\CodeFixes\Iterator\AbstractIteratorCodeFixProvider.cs (2)
24protected abstract Task<CodeAction> GetCodeFixAsync(SyntaxNode root, SyntaxNode node, Document document, Diagnostic diagnostics, CancellationToken cancellationToken); 36var codeAction = await GetCodeFixAsync(root, node, context.Document, diagnostic, context.CancellationToken).ConfigureAwait(false);
src\Analyzers\Core\CodeFixes\MakeMethodAsynchronous\AbstractMakeMethodAsynchronousCodeFixProvider.cs (2)
68CodeAction.Create( 79CodeAction.Create(
src\Analyzers\Core\CodeFixes\MakeMethodSynchronous\AbstractMakeMethodSynchronousCodeFixProvider.cs (1)
39CodeAction.Create(
src\Analyzers\Core\CodeFixes\MatchFolderAndNamespace\AbstractChangeNamespaceToMatchFolderCodeFixProvider.cs (1)
31CodeAction.Create(
src\Analyzers\Core\CodeFixes\MatchFolderAndNamespace\AbstractChangeNamespaceToMatchFolderCodeFixProvider.CustomFixAllProvider.cs (2)
28public override async Task<CodeAction?> GetFixAsync(FixAllContext fixAllContext) 42return CodeAction.Create(
src\Analyzers\Core\CodeFixes\NewLines\ConsecutiveStatementPlacement\ConsecutiveStatementPlacementCodeFixProvider.cs (1)
33context.RegisterCodeFix(CodeAction.Create(
src\Analyzers\Core\CodeFixes\NewLines\MultipleBlankLines\AbstractMultipleBlankLinesCodeFixProvider.cs (1)
33context.RegisterCodeFix(CodeAction.Create(
src\Analyzers\Core\CodeFixes\PopulateSwitch\AbstractPopulateSwitchCodeFixProvider.cs (3)
68CodeAction.Create( 80CodeAction.Create( 92CodeAction.Create(
src\Analyzers\Core\CodeFixes\RemoveAsyncModifier\AbstractRemoveAsyncModifierCodeFixProvider.cs (1)
55CodeAction.Create(
src\Analyzers\Core\CodeFixes\RemoveUnnecessaryImports\AbstractRemoveUnnecessaryImportsCodeFixProvider.cs (1)
29CodeAction.Create(
src\Analyzers\Core\CodeFixes\UnsealClass\AbstractUnsealClassCodeFixProvider.cs (1)
48CodeAction.Create(
src\Analyzers\Core\CodeFixes\UpgradeProject\AbstractUpgradeProjectCodeFixProvider.cs (3)
15using static Microsoft.CodeAnalysis.CodeActions.CodeAction; 41protected ImmutableArray<CodeAction> GetUpgradeProjectCodeActions(CodeFixContext context) 47var result = new List<CodeAction>();
src\Analyzers\Core\CodeFixes\UseIsNullCheck\AbstractUseIsNullForReferenceEqualsCodeFixProvider.cs (1)
43CodeAction.Create(title, GetDocumentUpdater(context), title),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\CodeFixContextExtensions.cs (4)
16internal static void RegisterFixes(this CodeFixContext context, IEnumerable<CodeAction> actions, Diagnostic diagnostic) 18foreach (var action in actions) 27internal static void RegisterFixes(this CodeFixContext context, IEnumerable<CodeAction> actions, ImmutableArray<Diagnostic> diagnostics) 31foreach (var action in actions)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\SyntaxEditorBasedCodeFixProvider.cs (2)
49=> context.RegisterCodeFix(CodeAction.Create(title, GetDocumentUpdater(context, diagnostic), equivalenceKey), context.Diagnostics); 52=> context.RegisterCodeFix(CodeAction.Create(title, GetDocumentUpdater(context, diagnostic), equivalenceKey, priority), context.Diagnostics);
Microsoft.CodeAnalysis.CodeStyle.UnitTestUtilities (9)
src\Features\DiagnosticsTestUtilities\CodeActions\CSharpCodeFixVerifier`2+Test.cs (3)
82public Action<ImmutableArray<CodeAction>>? CodeActionsVerifier { get; set; } 113protected override ImmutableArray<CodeAction> FilterCodeActions(ImmutableArray<CodeAction> actions)
src\Features\DiagnosticsTestUtilities\CodeActions\CSharpCodeRefactoringVerifier`1+Test.cs (3)
80/// The set of code action <see cref="CodeAction.Title"/>s offered the user in this exact order. 91protected override ImmutableArray<CodeAction> FilterCodeActions(ImmutableArray<CodeAction> actions)
src\Features\DiagnosticsTestUtilities\CodeActions\VisualBasicCodeRefactoringVerifier`1+Test.cs (3)
72/// The set of code action <see cref="CodeAction.Title"/>s offered the user in this exact order. 83protected override ImmutableArray<CodeAction> FilterCodeActions(ImmutableArray<CodeAction> actions)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (38)
src\Analyzers\CSharp\CodeFixes\AssignOutParameters\AssignOutParametersAtStartCodeFixProvider.cs (1)
48CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\ConditionalExpressionInStringInterpolation\CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (2)
44var documentChangeAction = CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceCodeFixProvider.cs (1)
45CodeAction.Create(title, GetDocumentUpdater(context), equivalenceKey),
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (3)
33public static async Task<CodeAction?> GetCodeActionAsync( 66var positional = CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\GenerateConstructor\GenerateConstructorCodeFixProvider.cs (1)
43protected override Task<ImmutableArray<CodeAction>> GetCodeActionsAsync(
src\Analyzers\CSharp\CodeFixes\GenerateEnumMember\GenerateEnumMemberCodeFixProvider.cs (1)
32protected override Task<ImmutableArray<CodeAction>> GetCodeActionsAsync(Document document, SyntaxNode node, CancellationToken cancellationToken)
src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateConversionCodeFixProvider.cs (1)
58protected override Task<ImmutableArray<CodeAction>> GetCodeActionsAsync(
src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateMethodCodeFixProvider.cs (1)
81protected override Task<ImmutableArray<CodeAction>> GetCodeActionsAsync(
src\Analyzers\CSharp\CodeFixes\GenerateVariable\CSharpGenerateVariableCodeFixProvider.cs (1)
57protected override async Task<ImmutableArray<CodeAction>> GetCodeActionsAsync(
src\Analyzers\CSharp\CodeFixes\HideBase\HideBaseCodeFixProvider.AddNewKeywordAction.cs (1)
23private sealed class AddNewKeywordAction(Document document, SyntaxNode node) : CodeAction
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpAddYieldCodeFixProvider.cs (2)
44protected override async Task<CodeAction?> GetCodeFixAsync(SyntaxNode root, SyntaxNode node, Document document, Diagnostic diagnostics, CancellationToken cancellationToken) 81return CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpChangeToIEnumerableCodeFixProvider.cs (2)
35protected override async Task<CodeAction?> GetCodeFixAsync(SyntaxNode root, SyntaxNode node, Document document, Diagnostic diagnostics, CancellationToken cancellationToken) 108return CodeAction.Create(title, _ => Task.FromResult(newDocument), title);
src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\PassInCapturedVariablesAsArgumentsCodeFixProvider.cs (1)
41CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\MakeRefStruct\MakeRefStructCodeFixProvider.cs (1)
55CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (1)
75CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (1)
36CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (1)
36CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementCodeFixProvider.cs (1)
36CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementCodeFixProvider.cs (1)
35CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementCodeFixProvider.cs (1)
38CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\RemoveConfusingSuppression\CSharpRemoveConfusingSuppressionCodeFixProvider.cs (2)
41CodeAction.Create( 48CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\RemoveInKeyword\RemoveInKeywordCodeFixProvider.cs (1)
47CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\RemoveNewModifier\RemoveNewModifierCodeFixProvider.cs (1)
49CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\RemoveUnusedLocalFunction\CSharpRemoveUnusedLocalFunctionCodeFixProvider.cs (1)
34CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\ReplaceDefaultLiteral\CSharpReplaceDefaultLiteralCodeFixProvider.cs (1)
55CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\UseExplicitTypeForConst\UseExplicitTypeForConstCodeFixProvider.cs (1)
53CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\UseExpressionBodyForLambda\UseExpressionBodyForLambdaCodeFixProvider.cs (2)
33var codeAction = CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\UseIsNullCheck\CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider.cs (1)
46CodeAction.Create(title, GetDocumentUpdater(context), title),
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (2)
63CodeAction.Create( 77CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\UseSystemThreadingLock\CSharpUseSystemThreadingLockCodeFixProvider.cs (1)
51CodeAction.Create(
Microsoft.CodeAnalysis.CSharp.CodeStyle.UnitTests (6)
src\Analyzers\CSharp\Tests\AddExplicitCast\AddExplicitCastTests.cs (2)
25protected override ImmutableArray<CodeAction> MassageActions(ImmutableArray<CodeAction> actions)
src\Analyzers\CSharp\Tests\AddParameter\AddParameterTests.cs (2)
33protected override ImmutableArray<CodeAction> MassageActions(ImmutableArray<CodeAction> actions)
src\Analyzers\CSharp\Tests\AliasAmbiguousType\AliasAmbiguousTypeTests.cs (2)
32protected override ImmutableArray<CodeAction> MassageActions(ImmutableArray<CodeAction> actions)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (32)
CodeActions\AddUsing\AddUsingNuGetTests.cs (2)
47protected override ImmutableArray<CodeAction> MassageActions(ImmutableArray<CodeAction> actions)
CodeActions\ApplyChangesOperationTests.cs (2)
246var refactorings = new List<CodeAction>(); 251var action = refactorings.Single();
CodeActions\GenerateType\GenerateTypeTests.cs (2)
36protected override ImmutableArray<CodeAction> MassageActions(ImmutableArray<CodeAction> codeActions)
CodeActions\GenerateType\GenerateTypeWithUnboundAnalyzerTests.cs (2)
31protected override ImmutableArray<CodeAction> MassageActions(ImmutableArray<CodeAction> codeActions)
CodeActions\ImplementInterface\ImplementExplicitlyTests.cs (2)
27protected override ImmutableArray<CodeAction> MassageActions(ImmutableArray<CodeAction> actions)
CodeActions\ImplementInterface\ImplementImplicitlyTests.cs (2)
29protected override ImmutableArray<CodeAction> MassageActions(ImmutableArray<CodeAction> actions)
CodeActions\PreviewExceptionTests.cs (3)
93var codeActions = new List<CodeAction>(); 103EditorTestWorkspace workspace, CodeRefactoringProvider provider, List<CodeAction> codeActions, 113var action = codeActions.Single();
CodeActions\PreviewTests.cs (2)
96var refactorings = new List<CodeAction>(); 99var action = refactorings.Single();
CodeActions\PullMemberUp\CSharpPullMemberUpTests.cs (2)
33protected override ImmutableArray<CodeAction> MassageActions(ImmutableArray<CodeAction> actions) => FlattenActions(actions);
CodeActions\SyncNamespace\CSharpSyncNamespaceTestsBase.cs (4)
100var renameFileAction = actions.Any(action => action is not CodeAction.SolutionChangeAction); 114var moveFileActions = actions.Where(a => a is not CodeAction.SolutionChangeAction); 214var hasChangeNamespaceAction = actions.Any(action => action is CodeAction.SolutionChangeAction); 223var changeNamespaceAction = actions.Single(a => a is CodeAction.SolutionChangeAction);
Diagnostics\FixAllProvider\BatchFixerTests.cs (2)
88var fix = CodeAction.Create("QualifyWithThisFix", _ => Task.FromResult(newDocument));
Formatting\CodeCleanupTests.TestFixers.cs (7)
28CodeAction.Create( 85public override Task<CodeAction?> GetFixAsync(FixAllContext fixAllContext) 88return Task.FromResult<CodeAction?>(CodeAction.Create( 141public override Task<CodeAction?> GetFixAsync(FixAllContext fixAllContext) 144return Task.FromResult<CodeAction?>(CodeAction.Create(
Microsoft.CodeAnalysis.CSharp.Features (89)
CodeFixes\GenerateType\GenerateTypeCodeFixProvider.cs (1)
62protected override Task<ImmutableArray<CodeAction>> GetCodeActionsAsync(
CodeRefactorings\ConvertLocalFunctionToMethod\CSharpConvertLocalFunctionToMethodCodeRefactoringProvider.cs (1)
59CodeAction.Create(
CodeRefactorings\EnableNullable\EnableNullableCodeRefactoringProvider.cs (1)
267: CodeAction.SolutionChangeAction(
CodeRefactorings\EnableNullable\EnableNullableCodeRefactoringProvider.FixAllProvider.cs (3)
34public override Task<CodeAction?> GetFixAsync(FixAllContext fixAllContext) 37return Task.FromResult<CodeAction?>(new FixAllCodeAction(EnableNullableReferenceTypesInSolutionAsync)); 57: CodeAction.SolutionChangeAction(
CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.cs (1)
90CodeAction.Create(
CodeRefactorings\UseExplicitOrImplicitType\AbstractUseTypeCodeRefactoringProvider.cs (1)
64CodeAction.Create(
CodeRefactorings\UseRecursivePatterns\UseRecursivePatternsCodeRefactoringProvider.cs (1)
66CodeAction.Create(
ConvertBetweenRegularAndVerbatimString\AbstractConvertBetweenRegularAndVerbatimStringCodeRefactoringProvider.cs (2)
63context.RegisterRefactoring(CodeAction.Create( 73context.RegisterRefactoring(CodeAction.Create(
ConvertNamespace\ConvertNamespaceCodeRefactoringProvider.cs (1)
55context.RegisterRefactoring(CodeAction.Create(
ConvertPrimaryToRegularConstructor\ConvertPrimaryToRegularConstructorCodeRefactoringProvider.cs (1)
58context.RegisterRefactoring(CodeAction.Create(
ConvertProgram\ConvertToProgramMainCodeRefactoringProvider.cs (1)
56context.RegisterRefactoring(CodeAction.Create(
ConvertProgram\ConvertToTopLevelStatementsCodeRefactoringProvider.cs (1)
59context.RegisterRefactoring(CodeAction.Create(
ConvertToRawString\ConvertStringToRawStringCodeRefactoringProvider.cs (3)
90CodeAction.Create( 100CodeAction.Create( 110CodeAction.Create(
Copilot\CSharpCopilotCodeFixProvider.cs (1)
91private static CodeAction? TryGetFix(
Copilot\CSharpCopilotCodeFixProvider.DismissChangesCodeAction.cs (1)
21private sealed class CopilotDismissChangesCodeAction(SyntaxNode originalMethodNode, Diagnostic diagnostic) : CodeAction
Copilot\CSharpCopilotCodeFixProvider.DocumentChangeCodeAction.cs (2)
26CodeActionPriority priority) : CodeAction.DocumentChangeAction(title, createChangedDocument, equivalenceKey, priority) 28internal sealed override ImmutableArray<CodeAction> AdditionalPreviewFlavors { get; } = [dismissChangesCodeAction];
ImplementInterface\AbstractChangeImplementationCodeRefactoringProvider.cs (6)
78var codeAction = CodeAction.Create( 104using var nestedActions = TemporaryArray<CodeAction>.Empty; 110nestedActions.Add(CodeAction.Create( 118nestedActions.Add(CodeAction.Create( 124context.RegisterRefactoring(CodeAction.Create(
InitializeParameter\CSharpInitializeMemberFromPrimaryConstructorParameterCodeRefactoringProvider.cs (10)
135static CodeAction CreateCodeAction(string title, Func<CancellationToken, Task<Solution>> createSolution) 136=> CodeAction.Create(title, createSolution, title); 138IEnumerable<CodeAction> HandleExistingFieldOrProperty() 146IEnumerable<CodeAction> HandleNoExistingFieldOrProperty() 157var fieldAction = CreateCodeAction( 160var propertyAction = CreateCodeAction( 170var allFieldsAction = CodeAction.Create( 173var allPropertiesAction = CodeAction.Create(
MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeRefactoringProvider.cs (1)
44context.RegisterRefactoring(CodeAction.Create(
ReverseForStatement\CSharpReverseForStatementCodeRefactoringProvider.cs (1)
80CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\AssignOutParameters\AssignOutParametersAtStartCodeFixProvider.cs (1)
48CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\ConditionalExpressionInStringInterpolation\CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (2)
44var documentChangeAction = CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceCodeFixProvider.cs (1)
45CodeAction.Create(title, GetDocumentUpdater(context), equivalenceKey),
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (3)
33public static async Task<CodeAction?> GetCodeActionAsync( 66var positional = CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\GenerateConstructor\GenerateConstructorCodeFixProvider.cs (1)
43protected override Task<ImmutableArray<CodeAction>> GetCodeActionsAsync(
src\Analyzers\CSharp\CodeFixes\GenerateEnumMember\GenerateEnumMemberCodeFixProvider.cs (1)
32protected override Task<ImmutableArray<CodeAction>> GetCodeActionsAsync(Document document, SyntaxNode node, CancellationToken cancellationToken)
src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateConversionCodeFixProvider.cs (1)
58protected override Task<ImmutableArray<CodeAction>> GetCodeActionsAsync(
src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateMethodCodeFixProvider.cs (1)
81protected override Task<ImmutableArray<CodeAction>> GetCodeActionsAsync(
src\Analyzers\CSharp\CodeFixes\GenerateVariable\CSharpGenerateVariableCodeFixProvider.cs (1)
57protected override async Task<ImmutableArray<CodeAction>> GetCodeActionsAsync(
src\Analyzers\CSharp\CodeFixes\HideBase\HideBaseCodeFixProvider.AddNewKeywordAction.cs (1)
23private sealed class AddNewKeywordAction(Document document, SyntaxNode node) : CodeAction
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpAddYieldCodeFixProvider.cs (2)
44protected override async Task<CodeAction?> GetCodeFixAsync(SyntaxNode root, SyntaxNode node, Document document, Diagnostic diagnostics, CancellationToken cancellationToken) 81return CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpChangeToIEnumerableCodeFixProvider.cs (2)
35protected override async Task<CodeAction?> GetCodeFixAsync(SyntaxNode root, SyntaxNode node, Document document, Diagnostic diagnostics, CancellationToken cancellationToken) 108return CodeAction.Create(title, _ => Task.FromResult(newDocument), title);
src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\PassInCapturedVariablesAsArgumentsCodeFixProvider.cs (1)
41CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\MakeRefStruct\MakeRefStructCodeFixProvider.cs (1)
55CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (1)
75CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (1)
36CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (1)
36CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementCodeFixProvider.cs (1)
36CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementCodeFixProvider.cs (1)
35CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementCodeFixProvider.cs (1)
38CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\RemoveConfusingSuppression\CSharpRemoveConfusingSuppressionCodeFixProvider.cs (2)
41CodeAction.Create( 48CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\RemoveInKeyword\RemoveInKeywordCodeFixProvider.cs (1)
47CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\RemoveNewModifier\RemoveNewModifierCodeFixProvider.cs (1)
49CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\RemoveUnusedLocalFunction\CSharpRemoveUnusedLocalFunctionCodeFixProvider.cs (1)
34CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\ReplaceDefaultLiteral\CSharpReplaceDefaultLiteralCodeFixProvider.cs (1)
55CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\UseExplicitTypeForConst\UseExplicitTypeForConstCodeFixProvider.cs (1)
53CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\UseExpressionBodyForLambda\UseExpressionBodyForLambdaCodeFixProvider.cs (2)
33var codeAction = CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\UseIsNullCheck\CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider.cs (1)
46CodeAction.Create(title, GetDocumentUpdater(context), title),
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (2)
63CodeAction.Create( 77CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorFixAllProvider.cs (1)
31public override Task<CodeAction?> GetFixAsync(FixAllContext fixAllContext)
src\Analyzers\CSharp\CodeFixes\UseSystemThreadingLock\CSharpUseSystemThreadingLockCodeFixProvider.cs (1)
51CodeAction.Create(
src\Analyzers\CSharp\CodeFixes\UseSystemThreadingLock\CSharpUseSystemThreadingLockFixAllProvider.cs (1)
23public override Task<CodeAction?> GetFixAsync(FixAllContext fixAllContext)
UseExpressionBody\UseExpressionBodyCodeRefactoringProvider.cs (2)
124CodeAction.Create( 137CodeAction.Create(
UseExpressionBodyForLambda\UseExpressionBodyForLambdaCodeRefactoringProvider.cs (6)
90private static async Task<ImmutableArray<CodeAction>> ComputeOpposingRefactoringsWhenAnalyzerActiveAsync( 146private static async Task<ImmutableArray<CodeAction>> ComputeAllRefactoringsWhenAnalyzerInactiveAsync( 162private static async Task<ImmutableArray<CodeAction>> ComputeRefactoringsAsync( 171using var result = TemporaryArray<CodeAction>.Empty; 175result.Add(CodeAction.Create( 185result.Add(CodeAction.Create(
UsePatternMatching\CSharpIsAndCastCheckWithoutNameCodeFixProvider.cs (1)
38CodeAction.Create(
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (35)
ConvertAnonymousType\ConvertAnonymousTypeToTupleTests.cs (2)
23protected override ImmutableArray<CodeAction> MassageActions(ImmutableArray<CodeAction> actions)
ConvertNumericLiteral\ConvertNumericLiteralTests.cs (2)
23protected override ImmutableArray<CodeAction> MassageActions(ImmutableArray<CodeAction> actions)
ConvertToRecord\ConvertToRecordCodeRefactoringTests.cs (2)
69CodeAction? codeAction = null; 86void Verify(CodeAction action, IVerifier _)
Diagnostics\Configuration\ConfigureCodeStyle\MultipleCodeStyleOptionConfigurationTests.cs (3)
26protected override ImmutableArray<CodeAction> MassageActions(ImmutableArray<CodeAction> actions) 29var nestedActionForOptionIndex = ((AbstractConfigurationActionWithNestedActions)actions[0]).NestedActions[OptionIndex];
Diagnostics\Suppression\SuppressionTests.cs (4)
756protected override async Task<(ImmutableArray<CodeAction>, CodeAction actionToInvoke)> GetCodeActionsAsync(TestWorkspace workspace, TestParameters parameters) 998protected override async Task<(ImmutableArray<CodeAction>, CodeAction actionToInvoke)> GetCodeActionsAsync(TestWorkspace workspace, TestParameters parameters)
FullyQualify\FullyQualifyTests.cs (2)
32protected override ImmutableArray<CodeAction> MassageActions(ImmutableArray<CodeAction> actions)
FullyQualify\FullyQualifyUnboundIdentifierTests.cs (2)
31protected override ImmutableArray<CodeAction> MassageActions(ImmutableArray<CodeAction> actions)
GenerateVariable\GenerateVariableTests.cs (2)
52protected override ImmutableArray<CodeAction> MassageActions(ImmutableArray<CodeAction> actions)
IntroduceParameter\IntroduceParameterTests.cs (2)
25protected override ImmutableArray<CodeAction> MassageActions(ImmutableArray<CodeAction> actions)
IntroduceVariable\InteractiveIntroduceVariableTests.cs (2)
23protected override ImmutableArray<CodeAction> MassageActions(ImmutableArray<CodeAction> actions)
IntroduceVariable\IntroduceVariableTests.cs (2)
28protected override ImmutableArray<CodeAction> MassageActions(ImmutableArray<CodeAction> actions)
SpellCheck\SpellCheckTests.cs (2)
32protected override ImmutableArray<CodeAction> MassageActions(ImmutableArray<CodeAction> actions)
src\Analyzers\CSharp\Tests\AddExplicitCast\AddExplicitCastTests.cs (2)
25protected override ImmutableArray<CodeAction> MassageActions(ImmutableArray<CodeAction> actions)
src\Analyzers\CSharp\Tests\AddParameter\AddParameterTests.cs (2)
33protected override ImmutableArray<CodeAction> MassageActions(ImmutableArray<CodeAction> actions)
src\Analyzers\CSharp\Tests\AliasAmbiguousType\AliasAmbiguousTypeTests.cs (2)
32protected override ImmutableArray<CodeAction> MassageActions(ImmutableArray<CodeAction> actions)
Wrapping\AbstractWrappingTests.cs (2)
23protected sealed override ImmutableArray<CodeAction> MassageActions(ImmutableArray<CodeAction> actions)
Microsoft.CodeAnalysis.EditorFeatures (4)
RenameTracking\RenameTrackingCodeRefactoringProvider.cs (1)
32this.CustomTags = this.CustomTags.Add(CodeAction.CanBeHighPriorityTag);
RenameTracking\RenameTrackingTaggerProvider.cs (1)
104public static (CodeAction action, TextSpan renameSpan) TryGetCodeAction(
RenameTracking\RenameTrackingTaggerProvider.RenameTrackingCodeAction.cs (1)
50this.CustomTags = this.CustomTags.Add(CodeAction.CanBeHighPriorityTag);
RenameTracking\RenameTrackingTaggerProvider.StateMachine.cs (1)
286internal (CodeAction action, TextSpan renameSpan) TryGetCodeAction(
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (12)
CodeFixes\CodeFixServiceTests.cs (5)
436CodeAction.Create( 817context.RegisterCodeFix(CodeAction.Create(_name, ct => Task.FromResult(context.Document)), fixableDiagnostics); 861CodeAction.Create( 944context.RegisterCodeFix(CodeAction.Create(Title, 1225CodeAction.Create(Title,
CodeFixes\ErrorCases\CodeFixExceptionInGetFixAllProvider.cs (1)
28context.RegisterCodeFix(CodeAction.Create("Do Nothing", token => Task.FromResult(context.Document)), context.Diagnostics[0]);
CodeRefactorings\CodeRefactoringServiceTest.cs (3)
67context.RegisterRefactoring(CodeAction.Create($"Blocking=false", _ => Task.FromResult<Document>(null))); 120context.RegisterRefactoring(CodeAction.Create( 241context.RegisterRefactoring(CodeAction.Create(Title,
LinkedFiles\LinkedFileDiffMergingEditorTests.cs (1)
111context.RegisterRefactoring(CodeAction.Create("Description", _ => Task.FromResult(newSolution)), context.Span);
RenameTracking\RenameTrackingTestState.cs (2)
166public async Task<CodeAction> TryGetCodeActionAsync(TextSpan? textSpan = null) 172var actions = new List<CodeAction>();
Microsoft.CodeAnalysis.EditorFeatures.Wpf (22)
Suggestions\Copilot\FlavoredSuggestedAction.cs (5)
17/// Each <see cref="CodeAction"/> can define custom <see cref="CodeAction.AdditionalPreviewFlavors"/> 21/// <see cref="CodeAction.AdditionalPreviewFlavors"/> and gets added to the suggested action set 33CodeAction originalCodeAction) 38public static SuggestedAction Create(SuggestedActionWithNestedFlavors suggestedAction, CodeAction codeAction)
Suggestions\PreviewChanges\PreviewChangesCodeAction.cs (2)
21private readonly CodeAction _originalCodeAction; 24public PreviewChangesCodeAction(Workspace workspace, CodeAction originalCodeAction, Func<CancellationToken, Task<SolutionPreviewResult?>> getPreviewResultAsync)
Suggestions\RefineUsingCopilot\RefineUsingCopilotCodeAction.cs (2)
29CodeAction originalCodeAction, 31ICopilotCodeAnalysisService copilotCodeAnalysisService) : CodeAction
Suggestions\SuggestedActions\AbstractFixAllSuggestedAction.cs (2)
22public CodeAction OriginalCodeAction { get; } 33CodeAction originalCodeAction,
Suggestions\SuggestedActions\CodeFixSuggestedAction.cs (1)
33CodeAction action,
Suggestions\SuggestedActions\CodeRefactoringSuggestedAction.cs (1)
30CodeAction codeAction,
Suggestions\SuggestedActions\FixAllCodeFixSuggestedAction.cs (1)
31CodeAction originalCodeAction)
Suggestions\SuggestedActions\FixAllCodeRefactoringSuggestedAction.cs (1)
27CodeAction originalCodeAction)
Suggestions\SuggestedActions\SuggestedAction.cs (3)
46internal readonly CodeAction CodeAction; 57CodeAction codeAction) 309var otherCodeAction = otherSuggestedAction.CodeAction;
Suggestions\SuggestedActionWithNestedActions.cs (2)
34CodeAction codeAction, 49CodeAction codeAction,
Suggestions\SuggestedActionWithNestedFlavors.cs (2)
47CodeAction codeAction, 126foreach (var action in this.CodeAction.AdditionalPreviewFlavors)
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (16)
CodeFixes\CodeFixServiceTests.vb (2)
230context.RegisterCodeFix(CodeAction.Create("FIX_TEST0000", Function(ct) Task.FromResult(context.Document.WithSyntaxRoot(root))), context.Diagnostics) 255context.RegisterCodeFix(CodeAction.Create("FIX_TEST1111", Function(ct) Task.FromResult(context.Document.WithSyntaxRoot(root))), context.Diagnostics)
Diagnostics\AbstractCrossLanguageUserDiagnosticTest.vb (5)
45Protected Overridable Function MassageActions(actions As IList(Of CodeAction)) As IList(Of CodeAction) 49Protected Shared Function FlattenActions(codeActions As IEnumerable(Of CodeAction)) As IList(Of CodeAction) 74Dim codeActions As IList(Of CodeAction) = diagnosticAndFix.Item2.Fixes.Select(Function(f) f.Action).ToList()
Diagnostics\AddImport\AddImportCrossLanguageTests.vb (5)
270glyphTags:=WellKnownTagArrays.CSharpProject.Add(CodeAction.RequiresNonDocumentChange), 358glyphTags:=WellKnownTagArrays.CSharpProject.Add(CodeAction.RequiresNonDocumentChange), 405glyphTags:=WellKnownTagArrays.CSharpProject.Add(CodeAction.RequiresNonDocumentChange), 451glyphTags:=WellKnownTagArrays.VisualBasicProject.Add(CodeAction.RequiresNonDocumentChange), 530glyphTags:=WellKnownTagArrays.CSharpProject.Add(CodeAction.RequiresNonDocumentChange),
Diagnostics\AdditionalFileDiagnosticsTests.vb (1)
123context.RegisterCodeFix(CodeAction.Create("Request serialization permission", Function(ct) Task.FromResult(newSln)), context.Diagnostics)
Diagnostics\GenerateFromUsage\GenerateVariableCrossLanguageTests.vb (2)
29Protected Overrides Function MassageActions(actions As IList(Of CodeAction)) As IList(Of CodeAction)
Rename\InlineRenameTests.vb (1)
1279Dim actions = New List(Of CodeAction)
Microsoft.CodeAnalysis.ExternalAccess.AspNetCore (2)
AddPackage\AspNetCoreAddPackageCodeAction.cs (2)
38public static async Task<CodeAction?> TryCreateCodeActionAsync( 67var cleanedDocument = await CodeAction.CleanupDocumentAsync(
Microsoft.CodeAnalysis.ExternalAccess.OmniSharp (2)
CodeActions\OmniSharpCodeFixContextFactory.cs (2)
21Action<CodeAction, ImmutableArray<Diagnostic>> registerCodeFix, 31Action<CodeAction, TextSpan?> registerRefactoring,
Microsoft.CodeAnalysis.ExternalAccess.Razor (1)
Cohost\Handlers\CodeActions.cs (1)
60var codeActionToResolve = CodeActionHelpers.GetCodeActionToResolve(data.CodeActionPath, codeActions, isFixAllAction: false);
Microsoft.CodeAnalysis.Features (389)
AddConstructorParametersFromMembers\AddConstructorParametersFromMembersCodeRefactoringProvider.AddConstructorParametersCodeAction.cs (1)
29bool useSubMenuName) : CodeAction
AddConstructorParametersFromMembers\AddConstructorParametersFromMembersCodeRefactoringProvider.cs (6)
80private static ImmutableArray<CodeAction> GetGroupedActions(AddConstructorParameterResult result) 82using var _ = ArrayBuilder<CodeAction>.GetInstance(out var actions); 87actions.Add(CodeAction.Create( 89result.RequiredParameterActions.Cast<AddConstructorParametersCodeAction, CodeAction>(), 93actions.Add(CodeAction.Create( 95result.OptionalParameterActions.Cast<AddConstructorParametersCodeAction, CodeAction>(),
AddDebuggerDisplay\AbstractAddDebuggerDisplayCodeRefactoringProvider.cs (1)
59context.RegisterRefactoring(CodeAction.Create(
AddFileBanner\AbstractAddFileBannerCodeRefactoringProvider.cs (1)
87CodeAction.Create(
AddImport\AbstractAddImportCodeFixProvider.cs (1)
33this.CustomTags = this.CustomTags.Add(CodeAction.CanBeHighPriorityTag);
AddImport\AbstractAddImportFeatureService.cs (3)
596public ImmutableArray<CodeAction> GetCodeActionsForFixes( 600using var _ = ArrayBuilder<CodeAction>.GetInstance(out var result); 612private static CodeAction? TryCreateCodeAction(Document document, AddImportFixData fixData, IPackageInstallerService? installerService)
AddImport\CodeActions\AddImportCodeAction.cs (1)
56this.CustomTags = this.CustomTags.Add(CodeAction.CanBeHighPriorityTag);
AddImport\CodeActions\InstallPackageAndAddImportCodeAction.cs (1)
55var solutionChangeAction = SolutionChangeAction.Create("", GetUpdatedSolutionAsync, "");
AddImport\CodeActions\InstallWithPackageManagerCodeAction.cs (1)
20string packageName) : CodeAction
AddImport\IAddImportFeatureService.cs (1)
42ImmutableArray<CodeAction> GetCodeActionsForFixes(
AddImport\References\Reference.cs (1)
117var cleanedDocument = await CodeAction.CleanupDocumentAsync(
AddImport\References\SymbolReference.cs (1)
65var cleanedDocument = await CodeAction.CleanupDocumentAsync(
AddMissingReference\AbstractAddMissingReferenceCodeFixProvider.cs (2)
45private static async Task<ImmutableArray<CodeAction>> GetAddReferencesCodeActionsAsync(CodeFixContext context, ISet<AssemblyIdentity> uniqueIdentities) 47var result = ArrayBuilder<CodeAction>.GetInstance();
AddMissingReference\AddMissingReferenceCodeAction.cs (2)
15internal sealed class AddMissingReferenceCodeAction(Project project, string title, ProjectReference? projectReferenceToAdd, AssemblyIdentity missingAssemblyIdentity) : CodeAction 29public static async Task<CodeAction> CreateAsync(Project project, AssemblyIdentity missingAssemblyIdentity, CancellationToken cancellationToken)
AddPackage\AbstractAddPackageCodeFixProvider.cs (2)
28protected async Task<ImmutableArray<CodeAction>> GetAddPackagesCodeActionsAsync( 49var codeActions = ArrayBuilder<CodeAction>.GetInstance();
AddPackage\InstallPackageDirectlyCodeAction.cs (1)
23bool isLocal) : CodeAction
AddPackage\InstallPackageParentCodeAction.cs (3)
30Document document) : CodeAction.CodeActionWithNestedActions(string.Format(FeaturesResources.Install_package_0, packageName), 40private static ImmutableArray<CodeAction> CreateNestedActions( 64private static CodeAction CreateCodeAction(
AddPackage\InstallWithPackageManagerCodeAction.cs (1)
17IPackageInstallerService installerService, string packageName) : CodeAction
AddPackage\ParentInstallPackageCodeAction.cs (5)
41internal sealed class ParentInstallPackageCodeAction : CodeAction.CodeActionWithNestedActions 66public static CodeAction? TryCreateCodeAction( 78private static ImmutableArray<CodeAction> CreateNestedActions( 87using var _ = ArrayBuilder<CodeAction>.GetInstance(out var codeActions); 107private static CodeAction CreateCodeAction(
CodeFixes\AbstractConfigurationActionWithNestedActions.cs (2)
15internal abstract class AbstractConfigurationActionWithNestedActions : CodeAction.CodeActionWithNestedActions 17protected AbstractConfigurationActionWithNestedActions(ImmutableArray<CodeAction> nestedActions, string title)
CodeFixes\Configuration\ConfigureCodeStyle\ConfigureCodeStyleOptionCodeFixProvider.cs (3)
21using static Microsoft.CodeAnalysis.CodeActions.CodeAction; 77using var _ = ArrayBuilder<CodeAction>.GetInstance(out var nestedActions); 107using var _ = ArrayBuilder<CodeAction>.GetInstance(out var nestedActions);
CodeFixes\Configuration\ConfigureCodeStyle\ConfigureCodeStyleOptionCodeFixProvider.TopLevelConfigureCodeStyleOptionCodeAction.cs (2)
14public TopLevelConfigureCodeStyleOptionCodeAction(Diagnostic diagnostic, ImmutableArray<CodeAction> nestedActions) 19public TopLevelConfigureCodeStyleOptionCodeAction(string optionName, ImmutableArray<CodeAction> nestedActions)
CodeFixes\Configuration\ConfigureSeverity\ConfigureSeverityLevelCodeFixProvider.cs (3)
16using static Microsoft.CodeAnalysis.CodeActions.CodeAction; 60var nestedActions = ArrayBuilder<CodeAction>.GetInstance(); 101var nestedActions = ArrayBuilder<CodeAction>.GetInstance();
CodeFixes\Configuration\ConfigureSeverity\ConfigureSeverityLevelCodeFixProvider.TopLevelBulkConfigureSeverityCodeAction.cs (1)
12private sealed class TopLevelBulkConfigureSeverityCodeAction(ImmutableArray<CodeAction> nestedActions, string? category) : AbstractConfigurationActionWithNestedActions(nestedActions,
CodeFixes\Configuration\ConfigureSeverity\ConfigureSeverityLevelCodeFixProvider.TopLevelConfigureSeverityCodeAction.cs (1)
14private sealed class TopLevelConfigureSeverityCodeAction(Diagnostic diagnostic, ImmutableArray<CodeAction> nestedActions) : AbstractConfigurationActionWithNestedActions(nestedActions, string.Format(FeaturesResources.Configure_0_severity, diagnostic.Id))
CodeFixes\Suppression\AbstractSuppressionBatchFixAllProvider.cs (25)
30public override async Task<CodeAction?> GetFixAsync(FixAllContext fixAllContext) 44private async Task<CodeAction?> GetFixAsync( 74private async Task<ImmutableArray<(Diagnostic diagnostic, CodeAction action)>> GetDiagnosticsAndCodeActionsAsync( 95return await ProducerConsumer<(Diagnostic diagnostic, CodeAction action)>.RunParallelAsync( 113Action<(Diagnostic diagnostic, CodeAction action)> onItemFound, 134private async Task<CodeAction?> GetFixAsync( 146var bag = new ConcurrentBag<(Diagnostic diagnostic, CodeAction action)>(); 175private static Action<CodeAction, ImmutableArray<Diagnostic>> GetRegisterCodeFixAction( 177Action<(Diagnostic diagnostic, CodeAction action)> onItemFound) 181using var _ = ArrayBuilder<CodeAction>.GetInstance(out var stack); 201ConcurrentBag<(Diagnostic diagnostic, CodeAction action)> fixes, 207public virtual async Task<CodeAction?> TryGetMergedFixAsync( 208ImmutableArray<(Diagnostic diagnostic, CodeAction action)> batchOfFixes, 219return CodeAction.SolutionChangeAction.Create(title, _ => Task.FromResult(newSolution), title); 227ImmutableArray<(Diagnostic diagnostic, CodeAction action)> diagnosticsAndCodeActions, 248private static async Task<IReadOnlyDictionary<DocumentId, ConcurrentBag<(CodeAction, Document)>>> GetDocumentIdToChangedDocumentsAsync( 250ImmutableArray<(Diagnostic diagnostic, CodeAction action)> diagnosticsAndCodeActions, 254var documentIdToChangedDocuments = new ConcurrentDictionary<DocumentId, ConcurrentBag<(CodeAction, Document)>>(); 272IReadOnlyDictionary<DocumentId, ConcurrentBag<(CodeAction, Document)>> documentIdToChangedDocuments, 273ImmutableArray<(Diagnostic diagnostic, CodeAction action)> diagnosticsAndCodeActions, 297Dictionary<CodeAction, int> codeActionToDiagnosticLocation, 299IEnumerable<(CodeAction action, Document document)> changedDocuments, 340private static readonly Func<DocumentId, ConcurrentBag<(CodeAction, Document)>> s_getValue = 345ConcurrentDictionary<DocumentId, ConcurrentBag<(CodeAction, Document)>> documentIdToChangedDocuments, 346CodeAction codeAction,
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.FixAllProvider.cs (1)
29public override async Task<CodeAction> GetFixAsync(FixAllContext fixAllContext)
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.GlobalSuppressMessageFixAllCodeAction.cs (2)
41internal static CodeAction Create(string title, AbstractSuppressionCodeFixProvider fixer, Document triggerDocument, ImmutableDictionary<Document, ImmutableArray<Diagnostic>> diagnosticsByDocument) 48internal static CodeAction Create(string title, AbstractSuppressionCodeFixProvider fixer, Project triggerProject, ImmutableDictionary<Project, ImmutableArray<Diagnostic>> diagnosticsByProject)
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaBatchFixHelpers.cs (3)
26public static CodeAction CreateBatchPragmaFix( 34return CodeAction.Create( 35((CodeAction)pragmaActions[0]).Title,
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaWarningBatchFixAllProvider.cs (2)
28Action<(Diagnostic diagnostic, CodeAction action)> onItemFound, 55var pragmaBatchFix = PragmaBatchFixHelpers.CreateBatchPragmaFix(
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction.BatchFixer.cs (8)
36Action<(Diagnostic diagnostic, CodeAction action)> onItemFound, 74var pragmaBatchFix = PragmaBatchFixHelpers.CreateBatchPragmaFix( 86ConcurrentBag<(Diagnostic diagnostic, CodeAction action)> bag, 105public override async Task<CodeAction> TryGetMergedFixAsync( 106ImmutableArray<(Diagnostic diagnostic, CodeAction action)> batchOfFixes, 119var newBatchOfFixes = new List<(Diagnostic diagnostic, CodeAction action)>(); 147var batchAttributeRemoveFix = CodeAction.Create(
CodeFixes\Suppression\TopLevelSuppressionCodeAction.cs (1)
12internal sealed class TopLevelSuppressionCodeAction(Diagnostic diagnostic, ImmutableArray<NestedSuppressionCodeAction> nestedActions) : AbstractConfigurationActionWithNestedActions(ImmutableArray<CodeAction>.CastUp(nestedActions), string.Format(FeaturesResources.Suppress_0, diagnostic.Id))
CodeFixesAndRefactorings\AbstractFixAllGetFixesService.cs (5)
28var codeAction = await GetFixAllCodeActionAsync(fixAllContext).ConfigureAwait(false); 41var codeAction = await GetFixAllCodeActionAsync(fixAllContext).ConfigureAwait(false); 52CodeAction codeAction, 157private static async Task<CodeAction?> GetFixAllCodeActionAsync(IFixAllContext fixAllContext) 176CodeAction? action = null;
CodeRefactorings\AddAwait\AbstractAddAwaitCodeRefactoringProvider.cs (2)
53CodeAction.Create( 61CodeAction.Create(
CodeRefactorings\AddMissingImports\AbstractAddMissingImportsFeatureService.cs (1)
205CodeAction codeAction,
CodeRefactorings\AddMissingImports\AbstractAddMissingImportsRefactoringProvider.cs (2)
51var addImportsCodeAction = CodeAction.Create(
CodeRefactorings\CodeRefactoring.cs (2)
27public ImmutableArray<(CodeAction action, TextSpan? applicableToSpan)> CodeActions { get; } 33ImmutableArray<(CodeAction, TextSpan?)> actions,
CodeRefactorings\CodeRefactoringContextExtensions.cs (1)
22where TCodeAction : CodeAction
CodeRefactorings\CodeRefactoringService.cs (1)
220using var _ = ArrayBuilder<(CodeAction action, TextSpan? applicableToSpan)>.GetInstance(out var actions);
CodeRefactorings\ExtractMethod\AbstractExtractMethodCodeRefactoringProvider.cs (9)
56private static async Task<ImmutableArray<CodeAction>> GetCodeActionsAsync( 62using var _ = ArrayBuilder<CodeAction>.GetInstance(out var actions); 63var methodAction = await ExtractMethodAsync(document, textSpan, extractOptions, cancellationToken).ConfigureAwait(false); 66var localFunctionAction = await ExtractLocalFunctionAsync(document, textSpan, extractOptions, cancellationToken).ConfigureAwait(false); 72private static async Task<CodeAction> ExtractMethodAsync( 87return CodeAction.Create( 97private static async Task<CodeAction> ExtractLocalFunctionAsync( 118var codeAction = CodeAction.Create(
CodeRefactorings\MoveType\AbstractMoveTypeService.cs (5)
33public abstract Task<ImmutableArray<CodeAction>> GetRefactoringAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken); 44public override async Task<ImmutableArray<CodeAction>> GetRefactoringAsync( 94private ImmutableArray<CodeAction> CreateActions(State state, CancellationToken cancellationToken) 109using var _ = ArrayBuilder<CodeAction>.GetInstance(out var actions); 168private CodeAction GetCodeAction(State state, string fileName, MoveTypeOperationKind operationKind)
CodeRefactorings\MoveType\IMoveTypeService.cs (1)
19Task<ImmutableArray<CodeAction>> GetRefactoringAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken);
CodeRefactorings\SyncNamespace\AbstractSyncNamespaceCodeRefactoringProvider.cs (2)
74var solutionChangeAction = CodeAction.Create(
CodeRefactorings\SyncNamespace\AbstractSyncNamespaceCodeRefactoringProvider.MoveFileCodeAction.cs (1)
26private sealed class MoveFileCodeAction(State state, ImmutableArray<string> newFolders) : CodeAction
Common\DocumentNavigationOperation.cs (2)
13/// When <see cref="CodeAction.GetOperationsAsync(CancellationToken)"/> is called an implementation 14/// of <see cref="CodeAction"/> can return an instance of this operation along with the other
Common\StartInlineRenameSessionOperation.cs (2)
13/// When <see cref="CodeAction.GetOperationsAsync(System.Threading.CancellationToken)"/> is called an implementation 14/// of <see cref="CodeAction"/> can return an instance of this operation along with the other
ConvertAnonymousType\AbstractConvertAnonymousTypeToClassCodeRefactoringProvider.cs (2)
64CodeAction.Create( 72CodeAction.Create(
ConvertAnonymousType\AbstractConvertAnonymousTypeToTupleCodeRefactoringProvider.cs (4)
57CodeAction.Create( 60CodeAction.Create(FeaturesResources.just_this_anonymous_type, c => FixInCurrentMemberAsync(document, anonymousNode, anonymousType, allAnonymousTypes: false, c), nameof(FeaturesResources.just_this_anonymous_type)), 61CodeAction.Create(FeaturesResources.all_anonymous_types_in_container, c => FixInCurrentMemberAsync(document, anonymousNode, anonymousType, allAnonymousTypes: true, c), nameof(FeaturesResources.all_anonymous_types_in_container)), 70CodeAction.Create(FeaturesResources.Convert_to_tuple, c => FixInCurrentMemberAsync(document, anonymousNode, anonymousType, allAnonymousTypes: false, c), nameof(FeaturesResources.Convert_to_tuple)),
ConvertAutoPropertyToFullProperty\AbstractConvertAutoPropertyToFullPropertyCodeRefactoringProvider.cs (1)
50CodeAction.Create(
ConvertCast\AbstractConvertCastCodeRefactoringProvider.cs (1)
60CodeAction.Create(
ConvertForEachToFor\AbstractConvertForEachToForCodeRefactoringProvider.cs (1)
78CodeAction.Create(
ConvertForToForEach\AbstractConvertForToForEachCodeRefactoringProvider.cs (1)
135CodeAction.Create(
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.cs (2)
51CodeAction.Create( 61CodeAction.Create(
ConvertLinq\AbstractConvertLinqQueryToForEachProvider.cs (1)
47CodeAction.Create(
ConvertLinq\ConvertForEachToLinqQuery\AbstractConvertForEachToLinqQueryProvider.cs (2)
114CodeAction.Create( 137CodeAction.Create(
ConvertNumericLiteral\AbstractConvertNumericLiteralCodeRefactoringProvider.cs (4)
71using var result = TemporaryArray<CodeAction>.Empty; 104context.RegisterRefactoring(CodeAction.Create( 110CodeAction CreateCodeAction(string text, string title) 111=> CodeAction.Create(title, c => ReplaceTokenAsync(document, root, numericToken, value, text, suffix), title);
ConvertToInterpolatedString\AbstractConvertConcatenationToInterpolatedStringRefactoringProvider.cs (1)
110CodeAction.Create(
ConvertToInterpolatedString\AbstractConvertPlaceholderToInterpolatedStringRefactoringProvider.cs (1)
106CodeAction.Create(
ConvertToInterpolatedString\ConvertRegularStringToInterpolatedStringRefactoringProvider.cs (1)
75CodeAction.Create(
ConvertTupleToStruct\AbstractConvertTupleToStructCodeRefactoringProvider.cs (6)
97CodeAction.Create( 109CodeAction.Create( 118ImmutableArray<CodeAction> CreateChildActions( 126using var scopes = TemporaryArray<CodeAction>.Empty; 170private CodeAction CreateAction(Document document, TextSpan span, Scope scope, bool isRecord) 171=> CodeAction.Create(GetTitle(scope), c => ConvertToStructAsync(document, span, scope, isRecord, c), scope.ToString());
EmbeddedLanguages\Json\LanguageServices\AbstractJsonDetectionCodeFixProvider.cs (1)
38CodeAction.Create(
EncapsulateField\AbstractEncapsulateFieldService.cs (8)
57public async Task<ImmutableArray<CodeAction>> GetEncapsulateFieldCodeActionsAsync(Document document, TextSpan span, CancellationToken cancellationToken) 68using var builder = TemporaryArray<CodeAction>.Empty; 81private ImmutableArray<CodeAction> EncapsulateAllFields(Document document, ImmutableArray<IFieldSymbol> fields) 83CodeAction.Create( 87CodeAction.Create( 93private ImmutableArray<CodeAction> EncapsulateOneField(Document document, IFieldSymbol field) 98CodeAction.Create( 102CodeAction.Create(
EncapsulateField\IEncapsulateFieldService.cs (1)
16Task<ImmutableArray<CodeAction>> GetEncapsulateFieldCodeActionsAsync(Document document, TextSpan span, CancellationToken cancellationToken);
Formatting\AbstractNewDocumentFormattingService.cs (1)
55document = await CodeAction.CleanupDocumentAsync(document, options, cancellationToken).ConfigureAwait(false);
FullyQualify\AbstractFullyQualifyCodeFixProvider.cs (2)
36d => CodeAction.Create( 49context.RegisterCodeFix(CodeAction.Create(
FullyQualify\AbstractFullyQualifyService.cs (1)
224var cleanedDocument = await CodeAction.CleanupDocumentAsync(
GenerateComparisonOperators\GenerateComparisonOperatorsCodeRefactoringProvider.cs (4)
97context.RegisterRefactoring(CodeAction.Create( 104using var _2 = ArrayBuilder<CodeAction>.GetInstance(out var nestedActions); 110nestedActions.Add(CodeAction.Create( 116context.RegisterRefactoring(CodeAction.Create(
GenerateConstructorFromMembers\AbstractGenerateConstructorFromMembersCodeRefactoringProvider.ConstructorDelegatingCodeAction.cs (1)
24bool addNullChecks) : CodeAction
GenerateConstructorFromMembers\AbstractGenerateConstructorFromMembersCodeRefactoringProvider.cs (9)
79using var _1 = ArrayBuilder<CodeAction>.GetInstance(out var actions); 107Document priorDocument, CodeAction codeAction, IProgress<CodeAnalysisProgress> progressTracker, CancellationToken cancellationToken) 126CodeAction action, 151Action<CodeAction, TextSpan> registerSingleAction, 152Action<ImmutableArray<CodeAction>> registerMultipleActions, 178private async Task<(CodeAction CodeAction, TextSpan ApplicableToSpan)?> HandleNonSelectionAsync( 253public async Task<ImmutableArray<CodeAction>> GenerateConstructorFromMembersAsync( 270private ImmutableArray<CodeAction> GetCodeActions(Document document, State state, bool addNullChecks) 272using var result = TemporaryArray<CodeAction>.Empty;
GenerateConstructorFromMembers\AbstractGenerateConstructorFromMembersCodeRefactoringProvider.FieldDelegatingCodeAction.cs (1)
22bool addNullChecks) : CodeAction
GenerateConstructorFromMembers\AbstractGenerateConstructorFromMembersCodeRefactoringProvider.GenerateConstructorWithDialogCodeAction.cs (1)
103: (CodeAction)new FieldDelegatingCodeAction(_service, _document, state, addNullChecks);
GenerateEqualsAndGetHashCodeFromMembers\GenerateEqualsAndGetHashCodeAction.cs (1)
29bool generateOperators) : CodeAction
GenerateEqualsAndGetHashCodeFromMembers\GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider.cs (6)
167public async Task<ImmutableArray<CodeAction>> GenerateEqualsAndGetHashCodeFromMembersAsync( 198private async Task<ImmutableArray<CodeAction>> CreateActionsAsync( 202using var _ = ArrayBuilder<Task<CodeAction>>.GetInstance(out var tasks); 238private Task<CodeAction> CreateCodeActionAsync( 255private async Task<CodeAction> CreateCodeActionWithDialogAsync( 292private static async Task<CodeAction> CreateCodeActionWithoutDialogAsync(
GenerateType\AbstractGenerateTypeService.cs (4)
71public async Task<ImmutableArray<CodeAction>> GenerateTypeAsync( 88return [CodeAction.Create( 103private ImmutableArray<CodeAction> GetActions( 109using var _ = ArrayBuilder<CodeAction>.GetInstance(out var result);
GenerateType\IGenerateTypeService.cs (1)
16Task<ImmutableArray<CodeAction>> GenerateTypeAsync(Document document, SyntaxNode node, CancellationToken cancellationToken);
InitializeParameter\AbstractAddParameterCheckCodeRefactoringProvider.cs (7)
51protected override async Task<ImmutableArray<CodeAction>> GetRefactoringsForAllParametersAsync( 76return [CodeAction.Create( 82protected override async Task<ImmutableArray<CodeAction>> GetRefactoringsForSingleParameterAsync( 100using var result = TemporaryArray<CodeAction>.Empty; 101result.Add(CodeAction.Create( 110result.Add(CodeAction.Create( 115result.Add(CodeAction.Create(
InitializeParameter\AbstractInitializeMemberFromParameterCodeRefactoringProviderMemberCreation.cs (19)
52protected sealed override Task<ImmutableArray<CodeAction>> GetRefactoringsForAllParametersAsync( 57return SpecializedTasks.EmptyImmutableArray<CodeAction>(); 60protected sealed override async Task<ImmutableArray<CodeAction>> GetRefactoringsForSingleParameterAsync( 106private async Task<ImmutableArray<CodeAction>> HandleNoExistingFieldOrPropertyAsync( 117using var _ = ArrayBuilder<CodeAction>.GetInstance(out var allActions); 158private (CodeAction? fieldAction, CodeAction? propertyAction) AddAllParameterInitializationActions( 177var allFieldsAction = CodeAction.Create( 182var allPropertiesAction = CodeAction.Create( 191private (CodeAction fieldAction, CodeAction propertyAction) AddSpecificParameterInitializationActions( 205var fieldAction = CodeAction.Create( 209var propertyAction = CodeAction.Create( 240private ImmutableArray<CodeAction> HandleExistingFieldOrProperty( 257return [CodeAction.Create(
InitializeParameter\AbstractInitializeParameterCodeRefactoringProvider.cs (2)
38protected abstract Task<ImmutableArray<CodeAction>> GetRefactoringsForAllParametersAsync( 47protected abstract Task<ImmutableArray<CodeAction>> GetRefactoringsForSingleParameterAsync(
InlineMethod\AbstractInlineMethodRefactoringProvider.cs (7)
238var nestedCodeAction = CodeAction.Create( 246private ImmutableArray<CodeAction> GenerateCodeActions(Document document, 256var codeActionRemovesCallee = CodeAction.Create( 271var codeActionKeepsCallee = CodeAction.Create(
IntroduceParameter\AbstractIntroduceParameterCodeRefactoringProvider.cs (8)
100CodeAction.Create( 109CodeAction.Create( 140private async Task<(ImmutableArray<CodeAction> actions, ImmutableArray<CodeAction> actionsAllOccurrences)?> GetActionsAsync(Document document, 149using var actionsBuilder = TemporaryArray<CodeAction>.Empty; 150using var actionsBuilderAllOccurrences = TemporaryArray<CodeAction>.Empty; 183CodeAction CreateNewCodeAction(string actionName, bool allOccurrences, IntroduceParameterCodeActionKind selectedCodeAction) 185return CodeAction.Create(
IntroduceUsingStatement\AbstractIntroduceUsingStatementCodeRefactoringProvider.cs (1)
54CodeAction.Create(
IntroduceVariable\AbstractIntroduceLocalForExpressionCodeRefactoringProvider.cs (2)
56CodeAction.Create( 64CodeAction.Create(
IntroduceVariable\AbstractIntroduceVariableService.cs (7)
62public async Task<CodeAction> IntroduceVariableAsync( 84return CodeAction.Create(title, actions, isInlinable: true); 92private (string title, ImmutableArray<CodeAction>) CreateActions(State state, CancellationToken cancellationToken) 94using var _ = ArrayBuilder<CodeAction>.GetInstance(out var actions); 100private string AddActionsAndGetTitle(State state, ArrayBuilder<CodeAction> actions, CancellationToken cancellationToken) 183private void CreateConstantFieldActions(State state, ArrayBuilder<CodeAction> actions, CancellationToken cancellationToken) 247private CodeAction CreateAction(State state, bool allOccurrences, bool isConstant, bool isLocal, bool isQueryLocal)
IntroduceVariable\IIntroduceVariableService.cs (1)
18Task<CodeAction> IntroduceVariableAsync(Document document, TextSpan textSpan, CodeCleanupOptions options, CancellationToken cancellationToken);
InvertConditional\AbstractInvertConditionalCodeRefactoringProvider.cs (1)
32CodeAction.Create(
InvertIf\AbstractInvertIfCodeRefactoringProvider.cs (1)
96CodeAction.Create(
InvertLogical\AbstractInvertLogicalCodeRefactoringProvider.cs (1)
75CodeAction.Create(
MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceCodeRefactoringProvider.cs (1)
45CodeAction.Create(
NameTupleElement\AbstractNameTupleElementCodeRefactoringProvider.cs (1)
33CodeAction.Create(
PreferFrameworkType\PreferFrameworkTypeCodeFixProvider.cs (1)
36CodeAction.Create(
PullMemberUp\AbstractPullMemberUpRefactoringProvider.cs (1)
61context.RegisterRefactoring(CodeAction.Create(
PullMemberUp\MembersPuller.cs (2)
24using static Microsoft.CodeAnalysis.CodeActions.CodeAction; 37public static CodeAction TryComputeCodeAction(
RemoveUnusedVariable\AbstractRemoveUnusedVariableCodeFixProvider.cs (1)
52CodeAction.Create(
ReplaceConditionalWithStatements\AbstractReplaceConditionalWithStatementsCodeRefactoringProvider.cs (2)
135context.RegisterRefactoring(CodeAction.Create( 163context.RegisterRefactoring(CodeAction.Create(
ReplaceDocCommentTextWithTag\AbstractReplaceDocCommentTextWithTagCodeRefactoringProvider.cs (1)
144CodeAction.Create(
ReplaceMethodWithProperty\ReplaceMethodWithPropertyCodeRefactoringProvider.cs (2)
69context.RegisterRefactoring(CodeAction.Create( 82context.RegisterRefactoring(CodeAction.Create(
ReplacePropertyWithMethods\ReplacePropertyWithMethodsCodeRefactoringProvider.cs (1)
68CodeAction.Create(
SimplifyThisOrMe\AbstractSimplifyThisOrMeCodeFixProvider.cs (1)
33CodeAction.Create(
SimplifyTypeNames\AbstractSimplifyTypeNamesCodeFixProvider.cs (1)
94CodeAction.Create(
SpellCheck\AbstractSpellCheckCodeFixProvider.cs (4)
178.ToImmutableArrayOrEmpty<CodeAction>(); 185CodeAction.Create( 211private CodeAction CreateCodeAction(SyntaxToken nameToken, string oldName, string newName, Document document) 213return CodeAction.Create(
SplitOrMergeIfStatements\AbstractMergeIfStatementsCodeRefactoringProvider.cs (1)
25protected abstract CodeAction CreateCodeAction(
SplitOrMergeIfStatements\AbstractSplitIfStatementCodeRefactoringProvider.cs (1)
23protected abstract CodeAction CreateCodeAction(Func<CancellationToken, Task<Document>> createChangedDocument, string ifKeywordText);
SplitOrMergeIfStatements\Consecutive\AbstractMergeConsecutiveIfStatementsCodeRefactoringProvider.cs (2)
48protected sealed override CodeAction CreateCodeAction(Func<CancellationToken, Task<Document>> createChangedDocument, MergeDirection direction, string ifKeywordText) 52return CodeAction.Create(title, createChangedDocument, title);
SplitOrMergeIfStatements\Consecutive\AbstractSplitIntoConsecutiveIfStatementsCodeRefactoringProvider.cs (2)
48protected sealed override CodeAction CreateCodeAction(Func<CancellationToken, Task<Document>> createChangedDocument, string ifKeywordText) 49=> CodeAction.Create(
SplitOrMergeIfStatements\Nested\AbstractMergeNestedIfStatementsCodeRefactoringProvider.cs (2)
36protected sealed override CodeAction CreateCodeAction(Func<CancellationToken, Task<Document>> createChangedDocument, MergeDirection direction, string ifKeywordText) 40return CodeAction.Create(title, createChangedDocument, title);
SplitOrMergeIfStatements\Nested\AbstractSplitIntoNestedIfStatementsCodeRefactoringProvider.cs (2)
34protected sealed override CodeAction CreateCodeAction(Func<CancellationToken, Task<Document>> createChangedDocument, string ifKeywordText) 35=> CodeAction.Create(
src\Analyzers\Core\CodeFixes\AddAnonymousTypeMemberName\AbstractAddAnonymousTypeMemberNameCodeFixProvider.cs (1)
46CodeAction.Create(
src\Analyzers\Core\CodeFixes\AddExplicitCast\AbstractAddExplicitCastCodeFixProvider.cs (3)
89using var actions = TemporaryArray<CodeAction>.Empty; 96actions.Add(CodeAction.Create( 111CodeAction.Create(CodeFixesResources.Add_explicit_cast, actions.ToImmutableAndClear(), isInlinable: false),
src\Analyzers\Core\CodeFixes\AddParameter\AbstractAddParameterCodeFixProvider.cs (12)
246ImmutableArray<CodeAction> NestByOverload() 248var builder = new FixedSizeArrayBuilder<CodeAction>(codeFixData.Length); 253var codeAction = CodeAction.Create( 264codeAction = CodeAction.Create( 268CodeAction.Create( 283ImmutableArray<CodeAction> NestByCascading() 285using var builder = TemporaryArray<CodeAction>.Empty; 290return CodeAction.Create(title, data.CreateChangedSolutionNonCascading, equivalenceKey: title); 298return CodeAction.Create(title, data.CreateChangedSolutionCascading!, equivalenceKey: title); 306builder.Add(CodeAction.Create(nestedNonCascadingTitle, nonCascadingActions, isInlinable: false)); 313builder.Add(CodeAction.Create(nestedCascadingTitle, cascadingActions, isInlinable: false));
src\Analyzers\Core\CodeFixes\AddRequiredParentheses\AddRequiredParenthesesCodeFixProvider.cs (1)
34CodeAction.Create(
src\Analyzers\Core\CodeFixes\AliasAmbiguousType\AbstractAliasAmbiguousTypeCodeFixProvider.cs (3)
53using var _ = ArrayBuilder<CodeAction>.GetInstance(out var actions); 59actions.Add(CodeAction.Create( 71CodeAction.Create(
src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (5)
51this.CustomTags = this.CustomTags.Add(CodeAction.CanBeHighPriorityTag); 300static CodeAction CreateCodeAction(string title, Func<CancellationToken, Task<Document>> action, string equivalenceKey) 302var codeAction = CodeAction.Create(title, action, equivalenceKey, CodeActionPriority.High); 306codeAction.CustomTags = codeAction.CustomTags.Add(CodeAction.CanBeHighPriorityTag);
src\Analyzers\Core\CodeFixes\ConvertToAsync\AbstractConvertToAsyncCodeFixProvider.cs (3)
40var codeAction = await GetCodeActionAsync( 61private async Task<CodeAction> GetCodeActionAsync( 74return CodeAction.Create(
src\Analyzers\Core\CodeFixes\DocumentationComments\AbstractAddDocCommentNodesCodeFixProvider.cs (1)
42CodeAction.Create(
src\Analyzers\Core\CodeFixes\DocumentationComments\AbstractRemoveDocCommentNodeCodeFixProvider.cs (1)
41CodeAction.Create(
src\Analyzers\Core\CodeFixes\FileHeaders\AbstractFileHeaderCodeFixProvider.cs (1)
36CodeAction.Create(
src\Analyzers\Core\CodeFixes\Formatting\FormattingCodeFixProvider.cs (4)
24this.CustomTags = this.CustomTags.Add(CodeAction.CanBeHighPriorityTag); 45var codeAction = CodeAction.Create( 53codeAction.CustomTags = codeAction.CustomTags.Add(CodeAction.CanBeHighPriorityTag);
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.cs (5)
78public async Task<ImmutableArray<CodeAction>> GenerateConstructorAsync(Document document, SyntaxNode node, CancellationToken cancellationToken) 89using var result = TemporaryArray<CodeAction>.Empty; 94result.Add(CodeAction.Create( 103result.Add(CodeAction.Create( 110result.Add(CodeAction.Create(
src\Analyzers\Core\CodeFixes\GenerateConstructor\IGenerateConstructorService.cs (1)
16Task<ImmutableArray<CodeAction>> GenerateConstructorAsync(Document document, SyntaxNode node, CancellationToken cancellationToken);
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.cs (2)
24public async Task<ImmutableArray<CodeAction>> GenerateDefaultConstructorsAsync( 34using var _ = ArrayBuilder<CodeAction>.GetInstance(out var result);
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\IGenerateDefaultConstructorsService.cs (1)
17Task<ImmutableArray<CodeAction>> GenerateDefaultConstructorsAsync(
src\Analyzers\Core\CodeFixes\GenerateEnumMember\AbstractGenerateEnumMemberService.CodeAction.cs (1)
19private sealed partial class GenerateEnumMemberCodeAction(Document document, State state) : CodeAction
src\Analyzers\Core\CodeFixes\GenerateEnumMember\AbstractGenerateEnumMemberService.cs (1)
29public async Task<ImmutableArray<CodeAction>> GenerateEnumMemberAsync(Document document, SyntaxNode node, CancellationToken cancellationToken)
src\Analyzers\Core\CodeFixes\GenerateEnumMember\IGenerateEnumMemberService.cs (1)
15Task<ImmutableArray<CodeAction>> GenerateEnumMemberAsync(Document document, SyntaxNode node, CancellationToken cancellationToken);
src\Analyzers\Core\CodeFixes\GenerateMember\AbstractGenerateMemberCodeFixProvider.cs (1)
27protected abstract Task<ImmutableArray<CodeAction>> GetCodeActionsAsync(Document document, SyntaxNode node, CancellationToken cancellationToken);
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateConversionService.cs (1)
29public async Task<ImmutableArray<CodeAction>> GenerateConversionAsync(
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateDeconstructMethodService.cs (1)
24public async Task<ImmutableArray<CodeAction>> GenerateDeconstructMethodAsync(
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateMethodService.cs (1)
30public async Task<ImmutableArray<CodeAction>> GenerateMethodAsync(
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.cs (2)
42protected async ValueTask<ImmutableArray<CodeAction>> GetActionsAsync(Document document, State state, CancellationToken cancellationToken) 44using var _ = ArrayBuilder<CodeAction>.GetInstance(out var result);
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\IGenerateConversionService.cs (1)
15Task<ImmutableArray<CodeAction>> GenerateConversionAsync(Document document, SyntaxNode node, CancellationToken cancellationToken);
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\IGenerateDeconstructMemberService.cs (1)
16Task<ImmutableArray<CodeAction>> GenerateDeconstructMethodAsync(
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\IGenerateParameterizedMemberService.cs (1)
16Task<ImmutableArray<CodeAction>> GenerateMethodAsync(Document document, SyntaxNode node, CancellationToken cancellationToken);
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.cs (9)
39public async Task<ImmutableArray<CodeAction>> GenerateVariableAsync( 54using var _ = ArrayBuilder<CodeAction>.GetInstance(out var actions); 82return [CodeAction.Create( 96ArrayBuilder<CodeAction> result, SemanticDocument document, State state, CancellationToken cancellationToken) 139private static void GenerateWritableProperty(ArrayBuilder<CodeAction> result, SemanticDocument document, State state) 146private static void AddFieldCodeActions(ArrayBuilder<CodeAction> result, SemanticDocument document, State state) 178private static void GenerateWriteableField(ArrayBuilder<CodeAction> result, SemanticDocument document, State state) 185ArrayBuilder<CodeAction> result, Document document, State state, CancellationToken cancellationToken) 201ArrayBuilder<CodeAction> result, Document document, State state, CancellationToken cancellationToken)
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.GenerateLocalCodeAction.cs (1)
21private sealed class GenerateLocalCodeAction(TService service, Document document, State state) : CodeAction
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.GenerateParameterCodeAction.cs (1)
16private sealed class GenerateParameterCodeAction(Document document, State state, bool includeOverridesAndImplementations, int parameterIndex) : CodeAction
src\Analyzers\Core\CodeFixes\GenerateVariable\IGenerateVariableService.cs (1)
17Task<ImmutableArray<CodeAction>> GenerateVariableAsync(Document document, SyntaxNode node, CancellationToken cancellationToken);
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\AbstractImplementAbstractClassCodeFixProvider.cs (2)
50CodeAction.Create( 64CodeAction.Create(
src\Analyzers\Core\CodeFixes\ImplementInterface\AbstractImplementInterfaceCodeFixProvider.cs (2)
53using var _ = ArrayBuilder<CodeAction>.GetInstance(out var codeActions); 58codeActions.Add(CodeAction.Create(
src\Analyzers\Core\CodeFixes\Iterator\AbstractIteratorCodeFixProvider.cs (2)
24protected abstract Task<CodeAction> GetCodeFixAsync(SyntaxNode root, SyntaxNode node, Document document, Diagnostic diagnostics, CancellationToken cancellationToken); 36var codeAction = await GetCodeFixAsync(root, node, context.Document, diagnostic, context.CancellationToken).ConfigureAwait(false);
src\Analyzers\Core\CodeFixes\MakeMethodAsynchronous\AbstractMakeMethodAsynchronousCodeFixProvider.cs (2)
68CodeAction.Create( 79CodeAction.Create(
src\Analyzers\Core\CodeFixes\MakeMethodSynchronous\AbstractMakeMethodSynchronousCodeFixProvider.cs (1)
39CodeAction.Create(
src\Analyzers\Core\CodeFixes\MatchFolderAndNamespace\AbstractChangeNamespaceToMatchFolderCodeFixProvider.cs (1)
31CodeAction.Create(
src\Analyzers\Core\CodeFixes\MatchFolderAndNamespace\AbstractChangeNamespaceToMatchFolderCodeFixProvider.CustomFixAllProvider.cs (2)
28public override async Task<CodeAction?> GetFixAsync(FixAllContext fixAllContext) 42return CodeAction.Create(
src\Analyzers\Core\CodeFixes\NewLines\ConsecutiveStatementPlacement\ConsecutiveStatementPlacementCodeFixProvider.cs (1)
33context.RegisterCodeFix(CodeAction.Create(
src\Analyzers\Core\CodeFixes\NewLines\MultipleBlankLines\AbstractMultipleBlankLinesCodeFixProvider.cs (1)
33context.RegisterCodeFix(CodeAction.Create(
src\Analyzers\Core\CodeFixes\PopulateSwitch\AbstractPopulateSwitchCodeFixProvider.cs (3)
68CodeAction.Create( 80CodeAction.Create( 92CodeAction.Create(
src\Analyzers\Core\CodeFixes\RemoveAsyncModifier\AbstractRemoveAsyncModifierCodeFixProvider.cs (1)
55CodeAction.Create(
src\Analyzers\Core\CodeFixes\RemoveUnnecessaryImports\AbstractRemoveUnnecessaryImportsCodeFixProvider.cs (1)
29CodeAction.Create(
src\Analyzers\Core\CodeFixes\UnsealClass\AbstractUnsealClassCodeFixProvider.cs (1)
48CodeAction.Create(
src\Analyzers\Core\CodeFixes\UpgradeProject\AbstractUpgradeProjectCodeFixProvider.cs (3)
15using static Microsoft.CodeAnalysis.CodeActions.CodeAction; 41protected ImmutableArray<CodeAction> GetUpgradeProjectCodeActions(CodeFixContext context) 47var result = new List<CodeAction>();
src\Analyzers\Core\CodeFixes\UseIsNullCheck\AbstractUseIsNullForReferenceEqualsCodeFixProvider.cs (1)
43CodeAction.Create(title, GetDocumentUpdater(context), title),
SyncNamespaces\AbstractSyncNamespacesService.cs (2)
112CodeAction? action = null; 141var fixAllAction = await fixAllProvider.GetFixAsync(fixAllContext).ConfigureAwait(false);
UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (1)
74context.RegisterCodeFix(CodeAction.SolutionChangeAction.Create(
UseAutoProperty\UseAutoPropertyFixAllProvider.cs (1)
25public override Task<CodeAction?> GetFixAsync(FixAllContext fixAllContext)
UseNamedArguments\AbstractUseNamedArgumentsCodeRefactoringProvider.cs (3)
112CodeAction.Create( 119CodeAction.Create( 128CodeAction.Create(
Wrapping\AbstractCodeActionComputer.cs (4)
270public async Task<ImmutableArray<CodeAction>> GetTopLevelCodeActionsAsync(CancellationToken cancellationToken) 277using var result = TemporaryArray<CodeAction>.Empty; 296var sorted = WrapItemsAction.SortActionsByMostRecentlyUsed(ImmutableArray<CodeAction>.CastUp(wrappingActions)); 301result.Add(CodeAction.Create(
Wrapping\ICodeActionComputer.cs (1)
17Task<ImmutableArray<CodeAction>> GetTopLevelCodeActionsAsync(CancellationToken cancellationToken);
Wrapping\WrapItemsAction.cs (4)
13using static Microsoft.CodeAnalysis.CodeActions.CodeAction; 52public static ImmutableArray<CodeAction> SortActionsByMostRecentlyUsed(ImmutableArray<CodeAction> codeActions) 83private static string GetSortTitle(CodeAction codeAction)
Microsoft.CodeAnalysis.LanguageServer.Protocol (43)
Features\UnifiedSuggestions\UnifiedSuggestedActions\IFixAllCodeFixSuggestedAction.cs (1)
18CodeAction OriginalCodeAction { get; }
Features\UnifiedSuggestions\UnifiedSuggestedActions\IFixAllCodeRefactoringSuggestedAction.cs (1)
16CodeAction OriginalCodeAction { get; }
Features\UnifiedSuggestions\UnifiedSuggestedActions\IUnifiedSuggestedAction.cs (1)
16CodeAction OriginalCodeAction { get; }
Features\UnifiedSuggestions\UnifiedSuggestedActions\UnifiedCodeFixSuggestedAction.cs (1)
25CodeAction codeAction,
Features\UnifiedSuggestions\UnifiedSuggestedActions\UnifiedCodeRefactoringSuggestedAction.cs (1)
23CodeAction codeAction,
Features\UnifiedSuggestions\UnifiedSuggestedActions\UnifiedFixAllCodeFixSuggestedAction.cs (1)
23CodeAction codeAction,
Features\UnifiedSuggestions\UnifiedSuggestedActions\UnifiedFixAllCodeRefactoringSuggestedAction.cs (1)
21CodeAction codeAction,
Features\UnifiedSuggestions\UnifiedSuggestedActions\UnifiedSuggestedAction.cs (2)
17public CodeAction OriginalCodeAction { get; } 21public UnifiedSuggestedAction(Workspace workspace, CodeAction codeAction, CodeActionPriority codeActionPriority)
Features\UnifiedSuggestions\UnifiedSuggestedActions\UnifiedSuggestedActionWithNestedActions.cs (1)
22CodeAction codeAction,
Features\UnifiedSuggestions\UnifiedSuggestedActionsSource.cs (13)
21using static Microsoft.CodeAnalysis.CodeActions.CodeAction; 120Task<UnifiedSuggestedActionSet?> GetFixAllSuggestedActionSetAsync(CodeAction codeAction) 133Func<CodeAction, Task<UnifiedSuggestedActionSet?>> getFixAllSuggestedActionSetAsync, 145async Task<IUnifiedSuggestedAction> GetUnifiedSuggestedActionAsync(Solution originalSolution, CodeAction action, CodeFix fix) 150foreach (var nestedAction in action.NestedActions) 209CodeAction action, 322var suppressOrConfigureCodeAction = NoChangeAction.Create(CodeFixesResources.Suppress_or_configure_issues, nameof(CodeFixesResources.Suppress_or_configure_issues)); 424private static bool IsTopLevelSuppressionAction(CodeAction action) 427private static bool IsBulkConfigurationAction(CodeAction action) 479bool IsActionAndSpanApplicable((CodeAction action, TextSpan? applicableSpan) actionAndSpan) 539async Task<IUnifiedSuggestedAction> GetUnifiedSuggestedActionSetAsync(CodeAction codeAction, TextSpan? applicableToSpan, TextSpan selection, CancellationToken cancellationToken) 544foreach (var nestedAction in codeAction.NestedActions) 578CodeAction action,
Handler\CodeActions\CodeActionFixAllResolveHandler.cs (1)
56var codeActionToResolve = CodeActionHelpers.GetCodeActionToResolve(data.CodeActionPath, codeActions, isFixAllAction: true);
Handler\CodeActions\CodeActionHelpers.cs (18)
18using CodeAction = Microsoft.CodeAnalysis.CodeActions.CodeAction; 98|| suggestedAction.OriginalCodeAction.Tags.Contains(CodeAction.RequiresNonDocumentChange); 108var codeAction = suggestedAction.OriginalCodeAction; 142var codeAction = suggestedAction.OriginalCodeAction; 170CodeAction codeAction, 224var codeAction = suggestedAction.OriginalCodeAction; 304public static async Task<ImmutableArray<CodeAction>> GetCodeActionsAsync( 317var _ = ArrayBuilder<CodeAction>.GetInstance(out var codeActions); 343private static CodeAction GetNestedActionsFromActionSet(IUnifiedSuggestedAction suggestedAction, string? fixAllScope) 345var codeAction = suggestedAction.OriginalCodeAction; 351using var _ = ArrayBuilder<CodeAction>.GetInstance(out var nestedActions); 364return CodeAction.Create( 368private static void GetFixAllActionsFromActionSet(IUnifiedSuggestedAction suggestedAction, ArrayBuilder<CodeAction> codeActions, string? fixAllScope) 370var codeAction = suggestedAction.OriginalCodeAction; 426public static CodeAction GetCodeActionToResolve(string[] codeActionPath, ImmutableArray<CodeAction> codeActions, bool isFixAllAction) 428CodeAction? matchingAction = null; 445matchingAction = matchingActions.Single(action => isFixAllAction ? action is FixAllCodeAction : action is CodeAction);
Handler\CodeActions\CodeActionResolveHandler.cs (1)
87var codeActionToResolve = CodeActionHelpers.GetCodeActionToResolve(data.CodeActionPath, codeActions, isFixAllAction: false);
Microsoft.CodeAnalysis.Remote.ServiceHub (1)
Services\ConvertTupleToStructCodeRefactoringProvider\RemoteConvertTupleToStructCodeRefactoringService.cs (1)
88var cleaned = await CodeAction.CleanupDocumentAsync(document, options, cancellationToken).ConfigureAwait(false);
Microsoft.CodeAnalysis.TestAnalyzerReference (1)
NonSourceFileRefactoring.cs (1)
23context.RegisterRefactoring(CodeAction.Create(nameof(NonSourceFileRefactoring),
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (12)
src\Analyzers\VisualBasic\CodeFixes\GenerateConstructor\GenerateConstructorCodeFixProvider.vb (1)
34Protected Overrides Function GetCodeActionsAsync(document As Document, node As SyntaxNode, cancellationToken As CancellationToken) As Task(Of ImmutableArray(Of CodeAction))
src\Analyzers\VisualBasic\CodeFixes\GenerateEnumMember\GenerateEnumMemberCodeFixProvider.vb (1)
35Protected Overrides Function GetCodeActionsAsync(document As Document, node As SyntaxNode, cancellationToken As CancellationToken) As Task(Of ImmutableArray(Of CodeAction))
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\GenerateConversionCodeFixProvider.vb (1)
35Protected Overrides Function GetCodeActionsAsync(document As Document, node As SyntaxNode, cancellationToken As CancellationToken) As Task(Of ImmutableArray(Of CodeAction))
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\GenerateParameterizedMemberCodeFixProvider.vb (1)
54Protected Overrides Function GetCodeActionsAsync(document As Document, node As SyntaxNode, cancellationToken As CancellationToken) As Task(Of ImmutableArray(Of CodeAction))
src\Analyzers\VisualBasic\CodeFixes\GenerateVariable\VisualBasicGenerateVariableCodeFixProvider.vb (2)
38Protected Overrides Async Function GetCodeActionsAsync(document As Document, node As SyntaxNode, cancellationToken As CancellationToken) As Task(Of ImmutableArray(Of CodeAction)) 46Return ImmutableArray(Of CodeAction).Empty
src\Analyzers\VisualBasic\CodeFixes\Iterator\VisualBasicChangeToYieldCodeFixProvider.vb (3)
36Protected Overrides Function GetCodeFixAsync(root As SyntaxNode, node As SyntaxNode, document As Document, diagnostics As Diagnostic, cancellationToken As CancellationToken) As Task(Of CodeAction) 38Return SpecializedTasks.Null(Of CodeAction)() 47CodeAction.Create(
src\Analyzers\VisualBasic\CodeFixes\Iterator\VisualBasicConvertToIteratorCodeFixProvider.vb (3)
38Protected Overrides Async Function GetCodeFixAsync(root As SyntaxNode, node As SyntaxNode, document As Document, diagnostics As Diagnostic, cancellationToken As CancellationToken) As Task(Of CodeAction) 95Return CodeAction.Create(title, Function(c) Task.FromResult(document.WithSyntaxRoot(root)), title) 103Return CodeAction.Create(title, Function(c) Task.FromResult(document.WithSyntaxRoot(root)), title)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.UnitTests (6)
src\Analyzers\VisualBasic\Tests\AddExplicitCast\AddExplicitCastTests.vb (2)
20Protected Overrides Function MassageActions(actions As ImmutableArray(Of CodeAction)) As ImmutableArray(Of CodeAction)
src\Analyzers\VisualBasic\Tests\AddParameter\AddParameterTests.vb (2)
21Protected Overrides Function MassageActions(actions As ImmutableArray(Of CodeAction)) As ImmutableArray(Of CodeAction)
src\Analyzers\VisualBasic\Tests\AliasAmbiguousType\AliasAmbiguousTypeTests.vb (2)
20Protected Overrides Function MassageActions(actions As ImmutableArray(Of CodeAction)) As ImmutableArray(Of CodeAction)
Microsoft.CodeAnalysis.VisualBasic.Features (38)
CodeFixes\GenerateEndConstruct\GenerateEndConstructCodeFixProvider.vb (3)
85CodeAction.Create( 96CodeAction.Create( 107CodeAction.Create(
CodeFixes\GenerateEvent\GenerateEventCodeFixProvider.vb (5)
52Dim result As CodeAction = Nothing 76Private Shared Async Function GenerateEventFromAddRemoveHandlerAsync(document As Document, handlerStatement As AddRemoveHandlerStatementSyntax, cancellationToken As CancellationToken) As Task(Of CodeAction) 125cancellationToken As CancellationToken) As Task(Of CodeAction) 241Private Shared Async Function GenerateEventFromImplementsAsync(document As Document, node As QualifiedNameSyntax, cancellationToken As CancellationToken) As Task(Of CodeAction) 314Private Shared Async Function GenerateEventFromHandlesAsync(document As Document, handlesClauseItem As HandlesClauseItemSyntax, cancellationToken As CancellationToken) As Task(Of CodeAction)
CodeFixes\GenerateType\GenerateTypeCodeFixProvider.vb (1)
43Protected Overrides Function GetCodeActionsAsync(document As Document, node As SyntaxNode, cancellationToken As CancellationToken) As Task(Of ImmutableArray(Of CodeAction))
CodeFixes\IncorrectExitContinue\IncorrectExitContinueCodeFixProvider.vb (8)
85Dim codeActions As List(Of CodeAction) = Nothing 94Private Sub CreateContinueCodeActions(document As SemanticDocument, node As SyntaxNode, enclosingblocks As IEnumerable(Of SyntaxNode), ByRef codeActions As List(Of CodeAction), cancellationToken As CancellationToken) 104codeActions = New List(Of CodeAction) 126Private Sub CreateExitCodeActions(document As SemanticDocument, node As SyntaxNode, enclosingblocks As IEnumerable(Of SyntaxNode), ByRef codeActions As List(Of CodeAction), cancellationToken As CancellationToken) 136codeActions = New List(Of CodeAction) 310codeActions As IList(Of CodeAction)) 320codeActions As IList(Of CodeAction)) 325Private Shared Sub CreateReplaceTokenKeywordActions(blockKinds As IEnumerable(Of SyntaxKind), invalidToken As SyntaxToken, document As Document, codeActions As List(Of CodeAction))
CodeFixes\IncorrectFunctionReturnType\IncorrectFunctionReturnTypeCodeFixProvider.vb (3)
78Private Shared Async Function GetCodeActionsAsync(document As Document, node As SyntaxNode, rewrittenNode As SyntaxNode, cancellationToken As CancellationToken) As Task(Of IEnumerable(Of CodeAction)) 83Return {CodeAction.Create( 89Return SpecializedCollections.EmptyEnumerable(Of CodeAction)()
CodeFixes\MoveToTopOfFile\MoveToTopOfFileCodeFixProvider.vb (4)
64Dim result = SpecializedCollections.EmptyEnumerable(Of CodeAction)() 100Private Shared Function CreateActionForImports(document As Document, node As ImportsStatementSyntax, root As CompilationUnitSyntax, cancellationToken As CancellationToken) As IEnumerable(Of CodeAction) 122Private Shared Function CreateActionForOptions(document As Document, node As OptionStatementSyntax, root As CompilationUnitSyntax, cancellationToken As CancellationToken) As IEnumerable(Of CodeAction) 138Private Shared Function CreateActionForAttribute(document As Document, node As AttributesStatementSyntax, root As CompilationUnitSyntax, cancellationToken As CancellationToken) As IEnumerable(Of CodeAction)
CodeRefactorings\InlineTemporary\VisualBasicInlineTemporaryCodeRefactoringProvider.vb (1)
62CodeAction.Create(
RemoveSharedFromModuleMembers\VisualBasicRemoveSharedFromModuleMembersCodeFixProvider.vb (1)
52CodeAction.Create(
src\Analyzers\VisualBasic\CodeFixes\GenerateConstructor\GenerateConstructorCodeFixProvider.vb (1)
34Protected Overrides Function GetCodeActionsAsync(document As Document, node As SyntaxNode, cancellationToken As CancellationToken) As Task(Of ImmutableArray(Of CodeAction))
src\Analyzers\VisualBasic\CodeFixes\GenerateEnumMember\GenerateEnumMemberCodeFixProvider.vb (1)
35Protected Overrides Function GetCodeActionsAsync(document As Document, node As SyntaxNode, cancellationToken As CancellationToken) As Task(Of ImmutableArray(Of CodeAction))
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\GenerateConversionCodeFixProvider.vb (1)
35Protected Overrides Function GetCodeActionsAsync(document As Document, node As SyntaxNode, cancellationToken As CancellationToken) As Task(Of ImmutableArray(Of CodeAction))
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\GenerateParameterizedMemberCodeFixProvider.vb (1)
54Protected Overrides Function GetCodeActionsAsync(document As Document, node As SyntaxNode, cancellationToken As CancellationToken) As Task(Of ImmutableArray(Of CodeAction))
src\Analyzers\VisualBasic\CodeFixes\GenerateVariable\VisualBasicGenerateVariableCodeFixProvider.vb (2)
38Protected Overrides Async Function GetCodeActionsAsync(document As Document, node As SyntaxNode, cancellationToken As CancellationToken) As Task(Of ImmutableArray(Of CodeAction)) 46Return ImmutableArray(Of CodeAction).Empty
src\Analyzers\VisualBasic\CodeFixes\Iterator\VisualBasicChangeToYieldCodeFixProvider.vb (3)
36Protected Overrides Function GetCodeFixAsync(root As SyntaxNode, node As SyntaxNode, document As Document, diagnostics As Diagnostic, cancellationToken As CancellationToken) As Task(Of CodeAction) 38Return SpecializedTasks.Null(Of CodeAction)() 47CodeAction.Create(
src\Analyzers\VisualBasic\CodeFixes\Iterator\VisualBasicConvertToIteratorCodeFixProvider.vb (3)
38Protected Overrides Async Function GetCodeFixAsync(root As SyntaxNode, node As SyntaxNode, document As Document, diagnostics As Diagnostic, cancellationToken As CancellationToken) As Task(Of CodeAction) 95Return CodeAction.Create(title, Function(c) Task.FromResult(document.WithSyntaxRoot(root)), title) 103Return CodeAction.Create(title, Function(c) Task.FromResult(document.WithSyntaxRoot(root)), title)
Microsoft.CodeAnalysis.VisualBasic.Features.UnitTests (44)
AddConstructorParametersFromMembers\AddConstructorParametersFromMembersTests.vb (26)
37test.CodeActionVerifier = Sub(codeAction As CodeAction, verifier As IVerifier) 68test.CodeActionVerifier = Sub(codeAction As CodeAction, verifier As IVerifier) 105test.CodeActionVerifier = Sub(codeAction As CodeAction, verifier As IVerifier) 140test.CodeActionVerifier = Sub(codeAction As CodeAction, verifier As IVerifier) 175test.CodeActionVerifier = Sub(codeAction As CodeAction, verifier As IVerifier) 205test.CodeActionVerifier = Sub(codeAction As CodeAction, verifier As IVerifier) 247test.CodeActionVerifier = Sub(codeAction As CodeAction, verifier As IVerifier) 289test.CodeActionVerifier = Sub(codeAction As CodeAction, verifier As IVerifier) 561test.CodeActionVerifier = Sub(codeAction As CodeAction, verifier As IVerifier) 605test.CodeActionVerifier = Sub(codeAction As CodeAction, verifier As IVerifier) 649test.CodeActionVerifier = Sub(codeAction As CodeAction, verifier As IVerifier) 703test.CodeActionVerifier = Sub(codeAction As CodeAction, verifier As IVerifier) 753test.CodeActionVerifier = Sub(codeAction As CodeAction, verifier As IVerifier) 796test.CodeActionVerifier = Sub(codeAction As CodeAction, verifier As IVerifier) 840test.CodeActionVerifier = Sub(codeAction As CodeAction, verifier As IVerifier) 875test.CodeActionVerifier = Sub(codeAction As CodeAction, verifier As IVerifier) 910test.CodeActionVerifier = Sub(codeAction As CodeAction, verifier As IVerifier) 945test.CodeActionVerifier = Sub(codeAction As CodeAction, verifier As IVerifier) 980test.CodeActionVerifier = Sub(codeAction As CodeAction, verifier As IVerifier) 1015test.CodeActionVerifier = Sub(codeAction As CodeAction, verifier As IVerifier) 1051test.CodeActionVerifier = Sub(codeAction As CodeAction, verifier As IVerifier) 1087test.CodeActionVerifier = Sub(codeAction As CodeAction, verifier As IVerifier) 1122test.CodeActionVerifier = Sub(codeAction As CodeAction, verifier As IVerifier) 1157test.CodeActionVerifier = Sub(codeAction As CodeAction, verifier As IVerifier) 1192test.CodeActionVerifier = Sub(codeAction As CodeAction, verifier As IVerifier) 1227test.CodeActionVerifier = Sub(codeAction As CodeAction, verifier As IVerifier)
ConvertAnonymousType\ConvertAnonymousTypeToTupleTests.vb (2)
21Protected Overrides Function MassageActions(actions As ImmutableArray(Of CodeAction)) As ImmutableArray(Of CodeAction)
ConvertNumericLiteral\ConvertNumericLiteralTests.vb (2)
21Protected Overrides Function MassageActions(actions As ImmutableArray(Of CodeAction)) As ImmutableArray(Of CodeAction)
Diagnostics\Suppression\SuppressionTests.vb (2)
23Protected Overrides Function MassageActions(ByVal actions As ImmutableArray(Of CodeAction)) As ImmutableArray(Of CodeAction)
FullyQualify\FullyQualifyTests.vb (2)
22Protected Overrides Function MassageActions(actions As ImmutableArray(Of CodeAction)) As ImmutableArray(Of CodeAction)
GenerateComparisonOperators\GenerateComparisonOperatorsTests.vb (2)
21Protected Overrides Function MassageActions(actions As ImmutableArray(Of CodeAction)) As ImmutableArray(Of CodeAction)
GenerateVariable\GenerateVariableTests.vb (2)
20Protected Overrides Function MassageActions(actions As ImmutableArray(Of CodeAction)) As ImmutableArray(Of CodeAction)
IntroduceVariable\IntroduceVariableTests.vb (2)
22Protected Overrides Function MassageActions(actions As ImmutableArray(Of CodeAction)) As ImmutableArray(Of CodeAction)
SpellCheck\SpellCheckTests.vb (2)
22Protected Overrides Function MassageActions(actions As ImmutableArray(Of CodeAction)) As ImmutableArray(Of CodeAction)
Wrapping\AbstractParameterWrappingTests.vb (2)
21Protected Overrides Function MassageActions(actions As ImmutableArray(Of CodeAction)) As ImmutableArray(Of CodeAction)
Microsoft.CodeAnalysis.Workspaces (142)
CodeActions\Annotations\NavigationAnnotation.cs (1)
14/// to the transformations performed by the <see cref="CodeAction"/> infrastructure.
CodeActions\CodeAction.cs (56)
106private bool IsNonProgressApiOverridden(Dictionary<Type, bool> dictionary, Func<CodeAction, bool> computeResult) 120static codeAction => new Func<CancellationToken, Task<IEnumerable<CodeActionOperation>>>(codeAction.ComputeOperationsAsync).Method.DeclaringType != typeof(CodeAction)); 128static codeAction => new Func<CancellationToken, Task<Solution?>>(codeAction.GetChangedSolutionAsync).Method.DeclaringType != typeof(CodeAction)); 150/// Child actions contained within this <see cref="CodeAction"/>. Can be presented in a host to provide more 151/// potential solution actions to a particular problem. To create a <see cref="CodeAction"/> with nested 152/// actions, use <see cref="Create(string, ImmutableArray{CodeAction}, bool)"/>. 154public virtual ImmutableArray<CodeAction> NestedActions 161internal virtual ImmutableArray<CodeAction> AdditionalPreviewFlavors => []; 166internal ImmutableArray<CodeAction> NestedCodeActions 175/// nested options with less steps. To create a <see cref="CodeAction"/> with nested actions, use <see 176/// cref="Create(string, ImmutableArray{CodeAction}, bool)"/>. 276/// Override this method if you want to implement a <see cref="CodeAction"/> subclass that includes custom <see 290/// Override this method if you want to implement a <see cref="CodeAction"/> subclass that includes custom <see 317/// Override this method if you want to implement a <see cref="CodeAction"/> that has a set of preview operations that are different 325/// cref="CodeAction"/> subclass that changes more than one document. Override <see 337/// cref="CodeAction"/> subclass that changes more than one document. Prefer overriding this method over <see 366/// cref="CodeAction"/> subclass that changes a single document. Override <see 382/// cref="CodeAction"/> subclass that changes a single document. Prefer overriding this method over <see 448/// <param name="changedSolution">The solution changed by the <see cref="CodeAction"/>.</param> 474/// <param name="document">The document changed by the <see cref="CodeAction"/>.</param> 491/// Creates a <see cref="CodeAction"/> for a change to a single <see cref="Document"/>. 494/// <param name="title">Title of the <see cref="CodeAction"/>.</param> 496/// <param name="equivalenceKey">Optional value used to determine the equivalence of the <see cref="CodeAction"/> with other <see cref="CodeAction"/>s. See <see cref="CodeAction.EquivalenceKey"/>.</param> 498public static CodeAction Create(string title, Func<CancellationToken, Task<Document>> createChangedDocument, string? equivalenceKey) 502internal static CodeAction Create(string title, Func<IProgress<CodeAnalysisProgress>, CancellationToken, Task<Document>> createChangedDocument, string? equivalenceKey) 508public static CodeAction Create(string title, Func<CancellationToken, Task<Document>> createChangedDocument, string? equivalenceKey = null, CodeActionPriority priority = CodeActionPriority.Default) 513public static CodeAction Create(string title, Func<IProgress<CodeAnalysisProgress>, CancellationToken, Task<Document>> createChangedDocument, string? equivalenceKey = null, CodeActionPriority priority = CodeActionPriority.Default) 525/// Creates a <see cref="CodeAction"/> for a change to more than one <see cref="Document"/> within a <see cref="Solution"/>. 528/// <param name="title">Title of the <see cref="CodeAction"/>.</param> 530/// <param name="equivalenceKey">Optional value used to determine the equivalence of the <see cref="CodeAction"/> with other <see cref="CodeAction"/>s. See <see cref="CodeAction.EquivalenceKey"/>.</param> 532public static CodeAction Create(string title, Func<CancellationToken, Task<Solution>> createChangedSolution, string? equivalenceKey) 536/// Creates a <see cref="CodeAction"/> for a change to more than one <see cref="Document"/> within a <see cref="Solution"/>. 539/// <param name="title">Title of the <see cref="CodeAction"/>.</param> 541/// <param name="equivalenceKey">Optional value used to determine the equivalence of the <see cref="CodeAction"/> with other <see cref="CodeAction"/>s. See <see cref="CodeAction.EquivalenceKey"/>.</param> 543public static CodeAction Create(string title, Func<CancellationToken, Task<Solution>> createChangedSolution, string? equivalenceKey = null, CodeActionPriority priority = CodeActionPriority.Default) 548public static CodeAction Create(string title, Func<IProgress<CodeAnalysisProgress>, CancellationToken, Task<Solution>> createChangedSolution, string? equivalenceKey = null, CodeActionPriority priority = CodeActionPriority.Default) 560/// Creates a <see cref="CodeAction"/> representing a group of code actions. 562/// <param name="title">Title of the <see cref="CodeAction"/> group.</param> 567public static CodeAction Create(string title, ImmutableArray<CodeAction> nestedActions, bool isInlinable) 570/// <inheritdoc cref="Create(string, ImmutableArray{CodeAction}, bool)"/> 573public static CodeAction Create(string title, ImmutableArray<CodeAction> nestedActions, bool isInlinable, CodeActionPriority priority = CodeActionPriority.Default) 588bool createdFromFactoryMethod) : CodeAction 608ImmutableArray<CodeAction> nestedActions, 621ImmutableArray<CodeAction> nestedActions, 630ImmutableArray<CodeAction> nestedActions, 637public sealed override ImmutableArray<CodeAction> NestedActions { get; } 639private static string? ComputeEquivalenceKey(ImmutableArray<CodeAction> nestedActions) 644foreach (var action in nestedActions)
CodeActions\CodeActionPriority.cs (1)
34/// High priority code action. Note: High priority is simply a request on the part of a <see cref="CodeAction"/>.
CodeActions\CodeActionRequestPriority.cs (1)
69if (priority == CodeActionRequestPriority.High && !customTags.Contains(CodeAction.CanBeHighPriorityTag))
CodeActions\CodeActionWithOptions.cs (4)
15/// A <see cref="CodeAction"/> that can vary with user specified options. Override one of <see 30/// Gets the <see cref="CodeActionOperation"/>'s for this <see cref="CodeAction"/> given the specified options. 62/// Override this method to compute the operations that implement this <see cref="CodeAction"/>. 70/// Override this method to compute the operations that implement this <see cref="CodeAction"/>. Prefer
CodeActions\Operations\ApplyChangesOperation.cs (5)
19/// <see cref="CodeAction.GetOperationsAsync(CancellationToken)"/> may return at most one 21/// <see cref="ApplyChangesOperation"/>s, but if a <see cref="CodeAction"/> requires custom 24/// <description><text>Implement a custom <see cref="CodeAction"/> and <see cref="CodeActionOperation"/>s</text></description> 25/// <description><text>Do not return any <see cref="ApplyChangesOperation"/> from <see cref="CodeAction.GetOperationsAsync(CancellationToken)"/></text></description> 28/// <description><text>Produce a preview for <see cref="CodeAction.GetPreviewOperationsAsync(CancellationToken)"/>
CodeFixes\CodeFix.cs (6)
16/// that holds on to a <see cref="CodeAction"/> and the set of 17/// <see cref="Diagnostic"/>s that this <see cref="CodeAction"/> will fix. 22internal readonly CodeAction Action; 37/// cref="CodeFixContext.RegisterCodeFix(CodeAction, IEnumerable{Diagnostic})"/>). This could change 43internal CodeFix(Project project, CodeAction action, Diagnostic diagnostic) 50internal CodeFix(Project project, CodeAction action, ImmutableArray<Diagnostic> diagnostics)
CodeFixes\CodeFixContext.cs (15)
21private readonly Action<CodeAction, ImmutableArray<Diagnostic>> _registerCodeFix; 77/// <param name="registerCodeFix">Delegate to register a <see cref="CodeAction"/> fixing a subset of diagnostics.</param> 89Action<CodeAction, ImmutableArray<Diagnostic>> registerCodeFix, 109/// <param name="registerCodeFix">Delegate to register a <see cref="CodeAction"/> fixing a subset of diagnostics.</param> 120Action<CodeAction, ImmutableArray<Diagnostic>> registerCodeFix, 140/// <param name="registerCodeFix">Delegate to register a <see cref="CodeAction"/> fixing a subset of diagnostics.</param> 147Action<CodeAction, ImmutableArray<Diagnostic>> registerCodeFix, 165/// <param name="registerCodeFix">Delegate to register a <see cref="CodeAction"/> fixing a subset of diagnostics.</param> 171Action<CodeAction, ImmutableArray<Diagnostic>> registerCodeFix, 184/// <param name="action">The <see cref="CodeAction"/> that will be invoked to apply the fix.</param> 186public void RegisterCodeFix(CodeAction action, Diagnostic diagnostic) 204/// <param name="action">The <see cref="CodeAction"/> that will be invoked to apply the fix.</param> 206public void RegisterCodeFix(CodeAction action, IEnumerable<Diagnostic> diagnostics) 219/// <param name="action">The <see cref="CodeAction"/> that will be invoked to apply the fix.</param> 221public void RegisterCodeFix(CodeAction action, ImmutableArray<Diagnostic> diagnostics)
CodeFixes\FixAllOccurrences\BatchFixAllProvider.cs (8)
34public override Task<CodeAction?> GetFixAsync(FixAllContext fixAllContext) 154using var _2 = ArrayBuilder<CodeAction>.GetInstance(out var codeActions); 165foreach (var codeAction in codeActions) 230private static Action<CodeAction, ImmutableArray<Diagnostic>> GetRegisterCodeFixAction( 231string? codeActionEquivalenceKey, ArrayBuilder<CodeAction> codeActions) 235using var _ = ArrayBuilder<CodeAction>.GetInstance(out var builder); 237while (builder.TryPop(out var currentAction)) 246foreach (var nestedAction in currentAction.NestedActions)
CodeFixes\FixAllOccurrences\DocumentBasedFixAllProvider.cs (2)
38/// Produce a suitable title for the fix-all <see cref="CodeAction"/> this type creates in <see 63public sealed override Task<CodeAction?> GetFixAsync(FixAllContext fixAllContext)
CodeFixes\FixAllOccurrences\FixAllContext.cs (8)
60/// The <see cref="CodeAction.EquivalenceKey"/> value expected of a <see cref="CodeAction"/> participating in this fix all. 106/// <param name="codeActionEquivalenceKey">The <see cref="CodeAction.EquivalenceKey"/> value expected of a <see cref="CodeAction"/> participating in this fix all.</param> 143/// <param name="codeActionEquivalenceKey">The <see cref="CodeAction.EquivalenceKey"/> value expected of a <see cref="CodeAction"/> participating in this fix all.</param> 179/// <param name="codeActionEquivalenceKey">The <see cref="CodeAction.EquivalenceKey"/> value expected of a <see cref="CodeAction"/> participating in this fix all.</param>
CodeFixes\FixAllOccurrences\FixAllProvider.cs (2)
45public abstract Task<CodeAction?> GetFixAsync(FixAllContext fixAllContext); 94Task<CodeAction?> IFixAllProvider.GetFixAsync(IFixAllContext fixAllContext)
CodeFixes\FixAllOccurrences\NoOpFixAllProvider.cs (2)
25public override Task<CodeAction?> GetFixAsync(FixAllContext fixAllContext) 26=> Task.FromResult<CodeAction?>(null);
CodeFixes\Supression\IConfigurationFixProvider.cs (2)
25/// Gets one or more add suppression, remove suppression, or configuration fixes for the specified diagnostics represented as a list of <see cref="CodeAction"/>'s. 31/// Gets one or more add suppression, remove suppression, or configuration fixes for the specified no-location diagnostics represented as a list of <see cref="CodeAction"/>'s.
CodeFixesAndRefactorings\DefaultFixAllProviderHelpers.cs (2)
23public static async Task<CodeAction?> GetFixAsync<TFixAllContext>( 47return CodeAction.Create(
CodeFixesAndRefactorings\DocumentBasedFixAllProviderHelpers.cs (2)
47var cleanedSolution = await CodeAction.CleanSyntaxAndSemanticsAsync( 56var cleanedTexts = await CodeAction.GetAllChangedOrAddedDocumentIds(originalSolution, cleanedSolution)
CodeFixesAndRefactorings\IFixAllProvider.cs (1)
18Task<CodeAction?> GetFixAsync(IFixAllContext fixAllContext);
CodeRefactorings\CodeRefactoringContext.cs (9)
56private readonly Action<CodeAction, TextSpan?> _registerRefactoring; 65Action<CodeAction> registerRefactoring, 76Action<CodeAction> registerRefactoring, 87Action<CodeAction, TextSpan?> registerRefactoring, 101/// <param name="action">The <see cref="CodeAction"/> that will be invoked to apply the refactoring.</param> 102public void RegisterRefactoring(CodeAction action) => RegisterRefactoring(action, applicableToSpan: null); // We could pass this.Span as applicableToSpan instead but that would cause these refactorings to always be closest to current selection 107/// <param name="action">The <see cref="CodeAction"/> that will be invoked to apply the refactoring.</param> 113internal void RegisterRefactoring(CodeAction action, TextSpan applicableToSpan) => RegisterRefactoring(action, new Nullable<TextSpan>(applicableToSpan)); 115private void RegisterRefactoring(CodeAction action, TextSpan? applicableToSpan)
CodeRefactorings\FixAllOccurences\DocumentBasedFixAllProvider.cs (2)
39/// Produce a suitable title for the fix-all <see cref="CodeAction"/> this type creates in <see 64public sealed override Task<CodeAction?> GetFixAsync(FixAllContext fixAllContext)
CodeRefactorings\FixAllOccurences\FixAllContext.cs (2)
44/// The <see cref="CodeAction.EquivalenceKey"/> value expected of a <see cref="CodeAction"/> participating in this fix all.
CodeRefactorings\FixAllOccurences\FixAllProvider.cs (2)
40public abstract Task<CodeAction?> GetFixAsync(FixAllContext fixAllContext); 43Task<CodeAction?> IFixAllProvider.GetFixAsync(IFixAllContext fixAllContext)
CodeRefactorings\FixAllOccurences\FixAllState.cs (2)
40CodeAction codeAction) 52CodeAction codeAction)
Simplification\Simplifier.cs (1)
54/// The annotation <see cref="CodeAction.CleanupDocumentAsync"/> used to identify sub trees to look for symbol annotations on.
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\CodeFixContextExtensions.cs (4)
16internal static void RegisterFixes(this CodeFixContext context, IEnumerable<CodeAction> actions, Diagnostic diagnostic) 18foreach (var action in actions) 27internal static void RegisterFixes(this CodeFixContext context, IEnumerable<CodeAction> actions, ImmutableArray<Diagnostic> diagnostics) 31foreach (var action in actions)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\SyntaxEditorBasedCodeFixProvider.cs (2)
49=> context.RegisterCodeFix(CodeAction.Create(title, GetDocumentUpdater(context, diagnostic), equivalenceKey), context.Diagnostics); 52=> context.RegisterCodeFix(CodeAction.Create(title, GetDocumentUpdater(context, diagnostic), equivalenceKey, priority), context.Diagnostics);
Microsoft.CodeAnalysis.Workspaces.UnitTests (4)
BatchFixAllProviderTests.cs (4)
99var fixes = new List<CodeAction>(); 102fixes.Add(CodeAction.Create( 110fixes = [CodeAction.Create("Container", [.. fixes], isInlinable: false)]; 113foreach (var fix in fixes)
Microsoft.Gen.ComplianceReports.Unit.Tests (1)
test\Generators\Shared\RoslynTestUtils.cs (1)
481var actions = new List<CodeAction>();
Microsoft.Gen.ContextualOptions.Unit.Tests (1)
test\Generators\Shared\RoslynTestUtils.cs (1)
481var actions = new List<CodeAction>();
Microsoft.Gen.Logging.Unit.Tests (1)
test\Generators\Shared\RoslynTestUtils.cs (1)
481var actions = new List<CodeAction>();
Microsoft.Gen.Metrics.Unit.Tests (1)
test\Generators\Shared\RoslynTestUtils.cs (1)
481var actions = new List<CodeAction>();
Microsoft.Gen.MetricsReports.Unit.Tests (1)
test\Generators\Shared\RoslynTestUtils.cs (1)
481var actions = new List<CodeAction>();
Microsoft.Interop.ComInterfaceGenerator (5)
Analyzers\AddMarshalAsToElementFixer.cs (1)
43CodeAction.Create(
src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (4)
138CodeAction.Create( 147CodeAction.Create( 169public override async Task<CodeAction?> GetFixAsync(FixAllContext fixAllContext) 180return CodeAction.Create(codeFixProvider.GetDiagnosticTitle(options),
Microsoft.Interop.LibraryImportGenerator (8)
Analyzers\AddDisableRuntimeMarshallingAttributeFixer.cs (1)
37CodeAction.Create(
Analyzers\CustomMarshallerAttributeFixer.cs (3)
29public override async Task<CodeAction?> GetFixAsync(FixAllContext fixAllContext) 84return CodeAction.Create(SR.AddMissingCustomTypeMarshallerMembers, ct => Task.FromResult(symbolEditor.ChangedSolution)); 122CodeAction.Create(
src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (4)
138CodeAction.Create( 147CodeAction.Create( 169public override async Task<CodeAction?> GetFixAsync(FixAllContext fixAllContext) 180return CodeAction.Create(codeFixProvider.GetDiagnosticTitle(options),
Microsoft.ML.InternalCodeAnalyzer (6)
ContractsCheckNameofFixProvider.cs (5)
64context.RegisterCodeFix(CodeAction.Create(Title, 101context.RegisterCodeFix(CodeAction.Create(Title, 120context.RegisterCodeFix(CodeAction.Create(Title, 148context.RegisterCodeFix(CodeAction.Create(Title, 158context.RegisterCodeFix(CodeAction.Create(Title,
NameFixProvider.cs (1)
98context.RegisterCodeFix(CodeAction.Create(PrivateTitle,
Microsoft.VisualStudio.LanguageServices.Xaml (1)
CodeFixes\RemoveUnnecessaryUsings\XamlRemoveUnnecessaryUsingsCodeFixProvider.cs (1)
46CodeAction.Create(
Roslyn.VisualStudio.DiagnosticsWindow (1)
Panels\TelemetryPanel.xaml.cs (1)
131var codeActionType = typeof(CodeAction);
System.Text.RegularExpressions.Generator (1)
UpgradeToGeneratedRegexCodeFixer.cs (1)
58CodeAction.Create(
System.Windows.Forms.Analyzers.CodeFixes.CSharp (1)
System\Windows\Forms\CSharp\CodeFixes\AddDesignerSerializationVisibility\AddDesignerSerializationVisibilityCodeFixProvider.cs (1)
50CodeAction.Create(
System.Windows.Forms.Analyzers.CodeFixes.VisualBasic (1)
AddDesignerSerializationVisibility\AddDesignerSerializationVisibilityCodeFixProvider.vb (1)
56CodeAction.Create(