Browse Source

[Formatting] Improved the wrap if too long option.

newNRvisualizers
Mike Krüger 13 years ago
parent
commit
04127ad320
  1. 16
      ICSharpCode.NRefactory.CSharp/Formatter/AstFormattingVisitor.cs

16
ICSharpCode.NRefactory.CSharp/Formatter/AstFormattingVisitor.cs

@ -858,11 +858,14 @@ namespace ICSharpCode.NRefactory.CSharp
} }
curIndent.ExtraSpaces -= extraSpaces; curIndent.ExtraSpaces -= extraSpaces;
} }
if (methodClosingParenthesesOnNewLine) if (methodClosingParenthesesOnNewLine) {
FixStatementIndentation(rParToken.StartLocation); FixStatementIndentation(rParToken.StartLocation);
}
} else { } else {
foreach (var arg in parameters) { foreach (var arg in parameters) {
ForceSpacesBeforeRemoveNewLines(arg, spaceAfterMethodCallParameterComma && arg.PrevSibling.Role == Roles.Comma); if (methodCallArgumentWrapping == Wrapping.DoNotWrap) {
ForceSpacesBeforeRemoveNewLines(arg, spaceAfterMethodCallParameterComma && arg.PrevSibling.Role == Roles.Comma);
}
arg.AcceptVisitor(this); arg.AcceptVisitor(this);
} }
ForceSpacesBeforeRemoveNewLines(rParToken, spaceWithinMethodCallParentheses); ForceSpacesBeforeRemoveNewLines(rParToken, spaceWithinMethodCallParentheses);
@ -1686,7 +1689,7 @@ namespace ICSharpCode.NRefactory.CSharp
} }
} }
bool DoWrap(Wrapping wrapping, AstNode wrapNode) bool DoWrap (Wrapping wrapping, AstNode wrapNode)
{ {
return wrapping == Wrapping.WrapAlways || return wrapping == Wrapping.WrapAlways ||
options.WrapLineLength > 0 && wrapping == Wrapping.WrapIfTooLong && wrapNode.StartLocation.Column >= options.WrapLineLength; options.WrapLineLength > 0 && wrapping == Wrapping.WrapIfTooLong && wrapNode.StartLocation.Column >= options.WrapLineLength;
@ -1754,11 +1757,14 @@ namespace ICSharpCode.NRefactory.CSharp
} }
curIndent.ExtraSpaces -= extraSpaces; curIndent.ExtraSpaces -= extraSpaces;
} }
if (methodClosingParenthesesOnNewLine) if (methodClosingParenthesesOnNewLine) {
FixStatementIndentation(rParToken.StartLocation); FixStatementIndentation(rParToken.StartLocation);
}
} else { } else {
foreach (var arg in arguments) { foreach (var arg in arguments) {
ForceSpacesBeforeRemoveNewLines(arg, spaceAfterMethodCallParameterComma && arg.PrevSibling.Role == Roles.Comma); if (methodCallArgumentWrapping == Wrapping.DoNotWrap) {
ForceSpacesBeforeRemoveNewLines(arg, spaceAfterMethodCallParameterComma && arg.PrevSibling.Role == Roles.Comma);
}
arg.AcceptVisitor(this); arg.AcceptVisitor(this);
} }
ForceSpacesBeforeRemoveNewLines(rParToken, spaceWithinMethodCallParentheses); ForceSpacesBeforeRemoveNewLines(rParToken, spaceWithinMethodCallParentheses);

Loading…
Cancel
Save