Example #1
0
        public sealed override Task RegisterCodeFixesAsync(CodeFixContext context)
        {
            CodeAction codeAction = CodeAction.Create(
                "Use spaces instead of tab",
                cancellationToken => UseSpacesInsteadOfTabRefactoring.RefactorAsync(context.Document, context.Span, cancellationToken),
                GetEquivalenceKey(DiagnosticIdentifiers.UseSpacesInsteadOfTab));

            context.RegisterCodeFix(codeAction, context.Diagnostics);

            return(Task.CompletedTask);
        }
Example #2
0
        public sealed override Task RegisterCodeFixesAsync(CodeFixContext context)
        {
            CodeAction codeAction = CodeAction.Create(
                "Use spaces instead of tab",
                cancellationToken => UseSpacesInsteadOfTabRefactoring.RefactorAsync(context.Document, context.Span, cancellationToken),
                DiagnosticIdentifiers.UseSpacesInsteadOfTab + EquivalenceKeySuffix);

            context.RegisterCodeFix(codeAction, context.Diagnostics);

            var tcs = new TaskCompletionSource <object>();

            tcs.SetResult(null);

            return(tcs.Task);
        }