private async Task <Document> RemoveLeadingBlankLineAsync(Document document, ArgumentListSyntax syntax, CancellationToken cancellationToken) { var tabSize = document.Project.Solution.Workspace.Options.GetOption(FormattingOptions.TabSize, LanguageNames.CSharp); bool useTabs = document.Project.Solution.Workspace.Options.GetOption(FormattingOptions.UseTabs, LanguageNames.CSharp); var root = await document.GetSyntaxRootAsync(); var newSyntax = syntax.ReplaceToken( syntax.OpenParenToken, syntax.OpenParenToken .WithTrailingTrivia(SyntaxFactory.EndOfLine(Environment.NewLine))); newSyntax = newSyntax.ReplaceTokens( newSyntax.Arguments.GetSeparators(), (oldNode, newNode) => { if (oldNode.IsKind(SyntaxKind.CommaToken)) { return(oldNode.WithTrailingTrivia(SyntaxFactory.EndOfLine(Environment.NewLine)).WithLeadingTrivia()); } return(oldNode); }); var argumentTrivia = IndentationHelper.GetIndentationTriviaByNode(useTabs, tabSize, root, syntax.OpenParenToken, cancellationToken); newSyntax = newSyntax.ReplaceNodes( newSyntax.Arguments, (oldNode, newNode) => { if (oldNode.IsKind(SyntaxKind.Argument)) { return(IndentationHelper.FormatNodeRecursive(oldNode, argumentTrivia, useTabs, tabSize)); } return(oldNode); }); var newRoot = root.ReplaceNode(syntax, newSyntax); var newDoc = document.WithSyntaxRoot(newRoot); return(newDoc); }