Exemple #1
0
        public override SyntaxToken VisitToken(SyntaxToken token)
        {
            if (token.Parent is not MemberAccessExpressionSyntax memberAccessExpression)
            {
                return(token);
            }

            var identifierName = memberAccessExpression.GetIdentifierName();

            if (identifierName == nameof(ITargetDefinition.Executes) ||
                identifierName == nameof(ITargetDefinition.DependsOn) ||
                identifierName == nameof(ITargetDefinition.DependentFor) ||
                identifierName == nameof(ITargetDefinition.OnlyWhenStatic) ||
                identifierName == nameof(ITargetDefinition.OnlyWhenDynamic) ||
                identifierName == nameof(ITargetDefinition.ProceedAfterFailure))
            {
                return(token.WithLeadingTrivia(LineFeed.Concat(Indent).Concat(Indent)));
            }

            if (identifierName.StartsWith("Set"))
            {
                return(token.WithLeadingTrivia(LineFeed.Concat(Indent).Concat(Indent).Concat(Indent)));
            }

            return(token);
        }
Exemple #2
0
        public override SyntaxNode VisitPropertyDeclaration(PropertyDeclarationSyntax node)
        {
            node = (PropertyDeclarationSyntax)base.VisitPropertyDeclaration(node).NotNull();

            return((node.Type as SimpleNameSyntax)?.Identifier.Text == nameof(Target)
                ? node.WithLeadingTrivia(LineFeed.Concat(Indent))
                : node);
        }