Exemplo n.º 1
0
        private void ApplyBeginningOfTreeTriviaOperation(
            FormattingContext context, TokenStream tokenStream, CancellationToken cancellationToken)
        {
            if (!tokenStream.FormatBeginningOfTree)
            {
                return;
            }

            Action <int, TriviaData> beginningOfTreeTriviaInfoApplier = (i, info) =>
            {
                tokenStream.ApplyBeginningOfTreeChange(info);
            };

            // remove all leading indentation
            var triviaInfo = tokenStream.GetTriviaDataAtBeginningOfTree().WithIndentation(0, context, this.formattingRules, cancellationToken);

            triviaInfo.Format(context, this.formattingRules, beginningOfTreeTriviaInfoApplier, cancellationToken);
        }
 // local functions
 static void BeginningOfTreeTriviaInfoApplier(int i, TokenStream ts, TriviaData info)
 => ts.ApplyBeginningOfTreeChange(info);