Permalink
Browse files

Fixed parameter declaration wrapping.

  • Loading branch information...
1 parent aa66ee3 commit 52837f7e61502db907f01f102fef5c01ad6229e5 @mkrueger mkrueger committed Apr 19, 2012
Showing with 18 additions and 3 deletions.
  1. +18 −3 main/contrib/ICSharpCode.NRefactory.CSharp/Formatter/AstFormattingVisitor.cs
@@ -858,8 +858,12 @@ void FormatParameters(AstNode node)
}
curIndent.ExtraSpaces -= extraSpaces;
}
- if (methodClosingParenthesesOnNewLine) {
- FixStatementIndentation(rParToken.StartLocation);
+ if (!rParToken.IsNull) {
+ if (methodClosingParenthesesOnNewLine) {
+ FixStatementIndentation(rParToken.StartLocation);
+ } else {
+ ForceSpacesBeforeRemoveNewLines(rParToken, spaceWithinMethodCallParentheses);
+ }
}
} else {
foreach (var arg in parameters) {
@@ -872,7 +876,18 @@ void FormatParameters(AstNode node)
}
arg.AcceptVisitor(this);
}
- ForceSpacesBeforeRemoveNewLines(rParToken, spaceWithinMethodCallParentheses);
+ if (!rParToken.IsNull) {
+ if (methodCallArgumentWrapping == Wrapping.DoNotWrap) {
+ ForceSpacesBeforeRemoveNewLines(rParToken, spaceWithinMethodCallParentheses);
+ } else {
+ bool sameLine = rParToken.GetPrevNode().StartLocation.Line == rParToken.StartLocation.Line;
+ if (sameLine) {
+ ForceSpacesBeforeRemoveNewLines(rParToken, spaceWithinMethodCallParentheses);
+ } else {
+ FixStatementIndentation(rParToken.StartLocation);
+ }
+ }
+ }
}
if (!rParToken.IsNull) {
foreach (CSharpTokenNode comma in rParToken.Parent.Children.Where(n => n.Role == Roles.Comma)) {

0 comments on commit 52837f7

Please sign in to comment.