private void AddModifier(CodeFixContext context, Diagnostic diagnostic, MemberDeclarationSyntax memberDeclaration, SyntaxKind kind) { CodeAction codeAction = CodeAction.Create( $"Add '{ModifierHelper.GetModifierName(kind)}' modifier", cancellationToken => context.Document.InsertModifierAsync(memberDeclaration, kind, ModifierComparer.Instance, cancellationToken), GetEquivalenceKey(diagnostic, kind.ToString())); context.RegisterCodeFix(codeAction, diagnostic); }
public static void AddModifier( CodeFixContext context, Diagnostic diagnostic, MemberDeclarationSyntax memberDeclaration, SyntaxKind kind) { Document document = context.Document; CodeAction codeAction = CodeAction.Create( $"Add '{ModifierHelper.GetModifierName(kind)}' modifier", cancellationToken => AddModifier(document, memberDeclaration, kind, cancellationToken), AbstractCodeFixProvider.GetEquivalenceKey(diagnostic, kind.ToString())); context.RegisterCodeFix(codeAction, diagnostic); }