Пример #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);
        }
        public override void Initialize(AnalysisContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            base.Initialize(context);

            context.RegisterSyntaxTreeAction(f => UseSpacesInsteadOfTabRefactoring.Analyze(f));
        }
Пример #3
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);
        }
Пример #4
0
 private void AnalyzeSyntaxTree(SyntaxTreeAnalysisContext context)
 {
     UseSpacesInsteadOfTabRefactoring.Analyze(context);
 }