public static async Task ComputeRefactoringAsync(RefactoringContext context, EventDeclarationSyntax eventDeclaration)
        {
            if (!eventDeclaration.HasDocumentationComment())
            {
                SemanticModel semanticModel = await context.GetSemanticModelAsync().ConfigureAwait(false);

                BaseDocumentationCommentData data = DocumentationCommentGenerator.GenerateFromBase(eventDeclaration, semanticModel, context.CancellationToken);

                if (data.Success)
                {
                    RegisterRefactoring(context, eventDeclaration, data);
                }
            }
        }
Exemple #2
0
        public override SyntaxNode VisitEventDeclaration(EventDeclarationSyntax node)
        {
            bool isPubliclyVisible = IsPubliclyVisible(node);

            node = (EventDeclarationSyntax)base.VisitEventDeclaration(node);

            if (isPubliclyVisible &&
                !node.HasDocumentationComment())
            {
                return(AddDocumentationComment(node));
            }
            else
            {
                return(node);
            }
        }
        public static async Task ComputeRefactoringsAsync(RefactoringContext context, EventDeclarationSyntax eventDeclaration)
        {
            if (context.IsRefactoringEnabled(RefactoringDescriptors.CopyDocumentationCommentFromBaseMember) &&
                eventDeclaration.HeaderSpan().Contains(context.Span) &&
                !eventDeclaration.HasDocumentationComment())
            {
                SemanticModel semanticModel = await context.GetSemanticModelAsync().ConfigureAwait(false);

                CopyDocumentationCommentFromBaseMemberRefactoring.ComputeRefactoring(context, eventDeclaration, semanticModel);
            }

            if (context.IsRefactoringEnabled(RefactoringDescriptors.AddMemberToInterface) &&
                context.Span.IsEmptyAndContainedInSpanOrBetweenSpans(eventDeclaration.Identifier))
            {
                SemanticModel semanticModel = await context.GetSemanticModelAsync().ConfigureAwait(false);

                AddMemberToInterfaceRefactoring.ComputeRefactoring(context, eventDeclaration, semanticModel);
            }
        }