예제 #1
0
        public static IList<Edit> GetEdits(SyntaxTree syntaxTree, TextSpan textSpan, FormattingOptions options)
        {
            // Format.
            var formattingVisitor = new FormattingVisitor(syntaxTree, textSpan, options);
            formattingVisitor.Visit(syntaxTree.Root);

            return formattingVisitor.Edits.Values;
        }
예제 #2
0
        public static IList <TextChange> GetEdits(SyntaxTree syntaxTree, SyntaxNode syntaxNode, TextSpan textSpan, FormattingOptions options)
        {
            // Format.
            var formattingVisitor = new FormattingVisitor(syntaxTree, textSpan, options);

            formattingVisitor.Visit(syntaxNode);

            return(formattingVisitor.Edits.Values);
        }
예제 #3
0
        public static IReadOnlyList <FormattingSpan> GetFormattingSpans(this RazorSyntaxTree syntaxTree)
        {
            if (syntaxTree == null)
            {
                throw new ArgumentNullException(nameof(syntaxTree));
            }

            var visitor = new FormattingVisitor(syntaxTree.Source);

            visitor.Visit(syntaxTree.Root);

            return(visitor.FormattingSpans);
        }