Browse Source

[Formatting] Fixed space within empty parentheses options.

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

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

@ -1773,6 +1773,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1773,6 +1773,7 @@ namespace ICSharpCode.NRefactory.CSharp
bool newLineAferMethodCallOpenParentheses;
bool methodClosingParenthesesOnNewLine;
bool spaceWithinMethodCallParentheses;
bool spaceWithinEmptyParentheses;
bool spaceAfterMethodCallParameterComma;
bool spaceBeforeMethodCallParameterComma;
@ -1785,8 +1786,8 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1785,8 +1786,8 @@ namespace ICSharpCode.NRefactory.CSharp
methodClosingParenthesesOnNewLine = policy.IndexerClosingBracketOnNewLine;
spaceWithinMethodCallParentheses = policy.SpacesWithinBrackets;
spaceAfterMethodCallParameterComma = policy.SpaceAfterBracketComma;
spaceWithinEmptyParentheses = spaceWithinMethodCallParentheses;
spaceBeforeMethodCallParameterComma = policy.SpaceBeforeBracketComma;
rParToken = indexer.RBracketToken;
arguments = indexer.Arguments;
} else if (node is ObjectCreateExpression) {
@ -1797,7 +1798,8 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1797,7 +1798,8 @@ namespace ICSharpCode.NRefactory.CSharp
spaceWithinMethodCallParentheses = policy.SpacesWithinNewParentheses;
spaceAfterMethodCallParameterComma = policy.SpaceAfterNewParameterComma;
spaceBeforeMethodCallParameterComma = policy.SpaceBeforeNewParameterComma;
spaceWithinEmptyParentheses = policy.SpacesBetweenEmptyNewParentheses;
rParToken = oce.RParToken;
arguments = oce.Arguments;
} else {
@ -1808,7 +1810,8 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1808,7 +1810,8 @@ namespace ICSharpCode.NRefactory.CSharp
spaceWithinMethodCallParentheses = policy.SpaceWithinMethodCallParentheses;
spaceAfterMethodCallParameterComma = policy.SpaceAfterMethodCallParameterComma;
spaceBeforeMethodCallParameterComma = policy.SpaceBeforeMethodCallParameterComma;
spaceWithinEmptyParentheses = policy.SpaceBetweenEmptyMethodCallParentheses;
rParToken = invocationExpression.RParToken;
arguments = invocationExpression.Arguments;
}
@ -1852,11 +1855,11 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1852,11 +1855,11 @@ namespace ICSharpCode.NRefactory.CSharp
}
if (!rParToken.IsNull) {
if (methodCallArgumentWrapping == Wrapping.DoNotWrap) {
ForceSpacesBeforeRemoveNewLines(rParToken, spaceWithinMethodCallParentheses);
ForceSpacesBeforeRemoveNewLines(rParToken, arguments.Any() ? spaceWithinMethodCallParentheses : spaceWithinEmptyParentheses);
} else {
bool sameLine = rParToken.GetPrevNode().EndLocation.Line == rParToken.StartLocation.Line;
if (sameLine) {
ForceSpacesBeforeRemoveNewLines(rParToken, spaceWithinMethodCallParentheses);
ForceSpacesBeforeRemoveNewLines(rParToken, arguments.Any() ? spaceWithinMethodCallParentheses : spaceWithinEmptyParentheses);
} else {
FixStatementIndentation(rParToken.StartLocation);
}

Loading…
Cancel
Save