private void AddSuggestionsForNextParameters(IMethodSymbol methodSymbol, ArgumentListSyntax arguments) { var currentParamIndex = arguments.ChildTokens() .Where(t => t.IsKind(SyntaxKind.CommaToken)) .ToList() .IndexOf(this._token); var nextParamIndex = currentParamIndex + 1; if (methodSymbol.Parameters.Length <= nextParamIndex) { return; } this.AddDefaultSuggestion(this._provider.GenerateSuggestionForParameterWildcardOfType(_semanticModel, methodSymbol.Parameters[nextParamIndex].Type, arguments)); }
public ArgumentListSyntax UpdateArgumentList(ArgumentListSyntax node, bool isMemberAccess) { var newArguments = new SeparatedSyntaxList <ArgumentSyntax>(); var parentIndentWidth = node.Parent.GetLeadingTrivia().FirstOrDefault(x => x.IsKind(SyntaxKind.WhitespaceTrivia)).Span.Length; var argumentIndentWidth = isMemberAccess ? parentIndentWidth + 8 : parentIndentWidth + 4; foreach (var argument in node.Arguments) { var newWhitespaceTrivia = SyntaxFactory.SyntaxTrivia(SyntaxKind.WhitespaceTrivia, new string(' ', argumentIndentWidth)); var newArgument = argument .WithLeadingTrivia(newWhitespaceTrivia); var newExpression = Visit(newArgument.Expression); if (newExpression != null) { newArgument = newArgument .WithExpression(newExpression); } newArguments = newArguments.Add(newArgument); } node = node.WithArguments(newArguments); if (newArguments.Count > 0) { var oldArgumentTokens = node.ChildTokens().Where(x => !x.IsKind(SyntaxKind.CloseParenToken)); if (!oldArgumentTokens.All(x => x.TrailingTrivia.Any(trivia => trivia.IsKind(SyntaxKind.EndOfLineTrivia)))) { node = node.ReplaceTokens( oldArgumentTokens, (original, _) => original.WithTrailingTrivia(new[] { SyntaxFactory.EndOfLine("\n") })); } } return(node); }