提交 c0ab592c 编写于 作者: B Balaji Soundrarajan

Refactoring for readability

Refactoring for readability
上级 0eeaf054
......@@ -1748,13 +1748,12 @@ class F
}";
var tree = SyntaxFactory.ParseCompilationUnit(code);
var text = DefaultWorkspace.Options.GetOption(FormattingOptions.NewLine, LanguageNames.CSharp);
var newLine = SyntaxFactory.ElasticEndOfLine(text);
var newLineText = SyntaxFactory.ElasticEndOfLine(DefaultWorkspace.Options.GetOption(FormattingOptions.NewLine, LanguageNames.CSharp));
tree = tree.ReplaceTokens(tree.DescendantTokens(descendIntoTrivia: true)
.Where(tr => tr.IsKind(SyntaxKind.EndOfDirectiveToken)), (o, r) => o.WithTrailingTrivia(o.LeadingTrivia.Add(newLine))
.WithLeadingTrivia(SyntaxFactory.TriviaList())
.WithAdditionalAnnotations(SyntaxAnnotation.ElasticAnnotation));
.Where(tr => tr.IsKind(SyntaxKind.EndOfDirectiveToken)), (o, r) => o.WithTrailingTrivia(o.LeadingTrivia.Add(newLineText))
.WithLeadingTrivia(SyntaxFactory.TriviaList())
.WithAdditionalAnnotations(SyntaxAnnotation.ElasticAnnotation));
var formatted = Formatter.Format(tree, DefaultWorkspace, DefaultWorkspace.Options.WithChangedOption(FormattingOptions.UseTabs, LanguageNames.CSharp, true));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册