public static async Task ComputeRefactoringAsync(RefactoringContext context, EventFieldDeclarationSyntax eventFieldDeclaration)
        {
            if (!eventFieldDeclaration.HasSingleLineDocumentationComment())
            {
                SemanticModel semanticModel = await context.GetSemanticModelAsync().ConfigureAwait(false);

                BaseDocumentationCommentInfo info = DocumentationCommentGenerator.GenerateFromBase(eventFieldDeclaration, semanticModel, context.CancellationToken);

                if (info.Success)
                {
                    RegisterRefactoring(context, eventFieldDeclaration, info);
                }
            }
        }
コード例 #2
0
        public override SyntaxNode VisitEventFieldDeclaration(EventFieldDeclarationSyntax node)
        {
            bool isPubliclyVisible = node.IsPubliclyVisible();

            node = (EventFieldDeclarationSyntax)base.VisitEventFieldDeclaration(node);

            if (isPubliclyVisible &&
                !node.HasSingleLineDocumentationComment())
            {
                return(DocumentationCommentGenerator.GenerateAndAttach(node, _settings));
            }
            else
            {
                return(node);
            }
        }
コード例 #3
0
        public override SyntaxNode VisitEventFieldDeclaration(EventFieldDeclarationSyntax node)
        {
            bool isPubliclyVisible = node.IsPubliclyVisible();

            node = (EventFieldDeclarationSyntax)base.VisitEventFieldDeclaration(node);

            if (isPubliclyVisible &&
                !node.HasSingleLineDocumentationComment())
            {
                return(AddDocumentationComment(node));
            }
            else
            {
                return(node);
            }
        }
        public static async Task ComputeRefactoringAsync(RefactoringContext context, EventFieldDeclarationSyntax eventFieldDeclaration)
        {
            if (!eventFieldDeclaration.HasSingleLineDocumentationComment())
            {
                VariableDeclaratorSyntax variableDeclarator = eventFieldDeclaration.Declaration?.Variables.FirstOrDefault();

                if (variableDeclarator != null)
                {
                    SemanticModel semanticModel = await context.GetSemanticModelAsync().ConfigureAwait(false);

                    var eventSymbol = semanticModel.GetDeclaredSymbol(variableDeclarator) as IEventSymbol;

                    if (eventSymbol?.IsErrorType() == false)
                    {
                        ComputeRefactoring <IEventSymbol>(context, eventFieldDeclaration, eventSymbol, eventSymbol.OverriddenEvent);
                    }
                }
            }
        }