NamespaceDeclarationSyntax ApplyNodeChange(NamespaceDeclarationSyntax namespaceNode)
            {
                var triviList = namespaceNode.GetLeadingTrivia();

                var zeroCondition = _lastTokenIsAOpenBrace || _lastToken == default(SyntaxToken);

                triviList = CleanUpList(triviList, zeroCondition ? 0 : 1);

                namespaceNode =
                    namespaceNode
                    .WithOpenBraceToken(
                        namespaceNode.OpenBraceToken
                        .WithLeadingTrivia(
                            CleanUpListWithExactNumberOfWhitespaces(namespaceNode.OpenBraceToken.LeadingTrivia, 0, itsForCloseBrace: true)))
                    .WithCloseBraceToken(
                        namespaceNode.CloseBraceToken
                        .WithLeadingTrivia(
                            CleanUpListWithNoWhitespaces(namespaceNode.CloseBraceToken.LeadingTrivia, itsForCloseBrace: true))
                        )
                    .WithLeadingTrivia(triviList);

                _LastMember = null;

                return(namespaceNode);
            }
Exemplo n.º 2
0
        NamespaceDeclarationSyntax ApplyNodeChange(NamespaceDeclarationSyntax mainNode)
        {
            var leadingTriviaList = mainNode.GetLeadingTrivia();

            leadingTriviaList = CleanUpListWithDefaultWhitespaces(leadingTriviaList, CleanupTypes.Remove_DBL_Between_Namespace_Members);

            mainNode =
                mainNode
                .WithOpenBraceToken(ApplyOpenBracket(mainNode.OpenBraceToken))
                .WithCloseBraceToken(ApplyCloseBracket(mainNode.CloseBraceToken))
                .WithLeadingTrivia(leadingTriviaList);

            var firstToken = mainNode.OpenBraceToken.GetNextToken();

            mainNode = mainNode.ReplaceToken(firstToken, ApplyOpenBracket(firstToken));

            return(mainNode);
        }