diff options
author | Mike Krüger <mkrueger@novell.com> | 2009-03-15 10:42:45 +0300 |
---|---|---|
committer | Mike Krüger <mkrueger@novell.com> | 2009-03-15 10:42:45 +0300 |
commit | 3eee1a40bf1ca497d5c79337dfae3a7e66375be8 (patch) | |
tree | e79a8cd2ed91147c5a8a8a8b5f0ec5211be727fd /main/contrib | |
parent | f7250bb2a3213b5e26e5bb05f1ebf09a9932123e (diff) |
* Src/PrettyPrinter/CSharp/OutputFormatter.cs:
* Src/PrettyPrinter/CSharp/PrettyPrintOptions.cs:
* Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs: Added some
formatting options.
svn path=/trunk/monodevelop/; revision=129370
Diffstat (limited to 'main/contrib')
4 files changed, 365 insertions, 13 deletions
diff --git a/main/contrib/NRefactory/Project/ChangeLog b/main/contrib/NRefactory/Project/ChangeLog index 1f4dfeda73..0a04b979cc 100644 --- a/main/contrib/NRefactory/Project/ChangeLog +++ b/main/contrib/NRefactory/Project/ChangeLog @@ -1,3 +1,10 @@ +2009-03-15 Mike Krüger <mkrueger@novell.com> + + * Src/PrettyPrinter/CSharp/OutputFormatter.cs: + * Src/PrettyPrinter/CSharp/PrettyPrintOptions.cs: + * Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs: Added some + formatting options. + 2009-03-13 Mike Krüger <mkrueger@novell.com> * Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs: updated diff --git a/main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs b/main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs index 5e77ce157b..f6af31f9d0 100644 --- a/main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs +++ b/main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs @@ -2,10 +2,11 @@ // <copyright see="prj:///doc/copyright.txt"/> // <license see="prj:///doc/license.txt"/> // <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/> -// <version>$Revision: 3849 $</version> +// <version>$Revision: 3850 $</version> // </file> using System; +using System.Linq; using System.Collections; using System.Collections.Generic; using System.Diagnostics; @@ -243,6 +244,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter { outputFormatter.PrintIdentifier(attribute.Name); outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinMethodCallParentheses) { + outputFormatter.Space(); + } this.AppendCommaSeparatedList(attribute.PositionalArguments); if (attribute.NamedArguments != null && attribute.NamedArguments.Count > 0) { @@ -256,6 +260,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter } } } + if (this.prettyPrintOptions.WithinMethodCallParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); return null; } @@ -480,7 +487,14 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + bool withinParentheses = this.prettyPrintOptions.WithinMethodDeclarationParentheses && delegateDeclaration.Parameters.Any (); + if (withinParentheses) { + outputFormatter.Space(); + } AppendCommaSeparatedList(delegateDeclaration.Parameters); + if (withinParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); foreach (TemplateDefinition templateDefinition in delegateDeclaration.Templates) { TrackVisit(templateDefinition, data); @@ -719,11 +733,18 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + bool withinParentheses = this.prettyPrintOptions.WithinMethodDeclarationParentheses && methodDeclaration.Parameters.Any (); + if (withinParentheses) { + outputFormatter.Space(); + } if (methodDeclaration.IsExtensionMethod) { outputFormatter.PrintToken(Tokens.This); outputFormatter.Space(); } AppendCommaSeparatedList(methodDeclaration.Parameters); + if (withinParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); foreach (TemplateDefinition templateDefinition in methodDeclaration.Templates) { TrackVisit(templateDefinition, null); @@ -860,7 +881,14 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + bool withinParentheses = this.prettyPrintOptions.WithinMethodDeclarationParentheses && constructorDeclaration.Parameters.Any (); + if (withinParentheses) { + outputFormatter.Space(); + } AppendCommaSeparatedList(constructorDeclaration.Parameters); + if (withinParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); TrackVisit(constructorDeclaration.ConstructorInitializer, data); OutputBlock(constructorDeclaration.Body, this.prettyPrintOptions.ConstructorBraceStyle); @@ -881,7 +909,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.PrintToken(Tokens.This); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinMethodCallParentheses) { + outputFormatter.Space(); + } AppendCommaSeparatedList(constructorInitializer.Arguments); + if (this.prettyPrintOptions.WithinMethodCallParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); return null; } @@ -1210,7 +1244,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinIfParentheses) { + outputFormatter.Space(); + } TrackVisit(ifElseStatement.Condition, data); + if (this.prettyPrintOptions.WithinIfParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); PrintIfSection(ifElseStatement.TrueStatement); @@ -1257,7 +1297,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinIfParentheses) { + outputFormatter.Space(); + } TrackVisit(elseIfSection.Condition, data); + if (this.prettyPrintOptions.WithinIfParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); WriteEmbeddedStatement(elseIfSection.EmbeddedStatement); @@ -1272,6 +1318,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinForParentheses) { + outputFormatter.Space(); + } outputFormatter.DoIndent = false; outputFormatter.DoNewLine = false; outputFormatter.EmitSemicolon = false; @@ -1307,6 +1356,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter } } } + if (this.prettyPrintOptions.WithinForParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); outputFormatter.EmitSemicolon = true; outputFormatter.DoNewLine = true; @@ -1353,7 +1405,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinSwitchParentheses) { + outputFormatter.Space(); + } TrackVisit(switchStatement.SwitchExpression, data); + if (this.prettyPrintOptions.WithinSwitchParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); outputFormatter.Space(); outputFormatter.PrintToken(Tokens.OpenCurlyBrace); @@ -1498,6 +1556,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinWhileParentheses) { + outputFormatter.Space(); + } if (doLoopStatement.ConditionType == ConditionType.Until) { outputFormatter.PrintToken(Tokens.Not); @@ -1513,6 +1574,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter if (doLoopStatement.ConditionType == ConditionType.Until) { outputFormatter.PrintToken(Tokens.CloseParenthesis); } + if (this.prettyPrintOptions.WithinWhileParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); } @@ -1547,6 +1611,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinForEachParentheses) { + outputFormatter.Space(); + } TrackVisit(foreachStatement.TypeReference, data); outputFormatter.Space(); outputFormatter.PrintIdentifier(foreachStatement.VariableName); @@ -1554,6 +1621,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.PrintToken(Tokens.In); outputFormatter.Space(); TrackVisit(foreachStatement.Expression, data); + if (this.prettyPrintOptions.WithinForEachParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); WriteEmbeddedStatement(foreachStatement.EmbeddedStatement); @@ -1568,7 +1638,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinLockParentheses) { + outputFormatter.Space(); + } TrackVisit(lockStatement.LockExpression, data); + if (this.prettyPrintOptions.WithinLockParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); WriteEmbeddedStatement(lockStatement.EmbeddedStatement); @@ -1583,7 +1659,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (prettyPrintOptions.WithinUsingParentheses) { + outputFormatter.Space(); + } PrintStatementInline(usingStatement.ResourceAcquisition, data); + if (prettyPrintOptions.WithinUsingParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); WriteEmbeddedStatement(usingStatement.EmbeddedStatement); @@ -1635,11 +1717,17 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinCatchParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintIdentifier(catchClause.TypeReference.Type); if (catchClause.VariableName.Length > 0) { outputFormatter.Space(); outputFormatter.PrintIdentifier(catchClause.VariableName); } + if (this.prettyPrintOptions.WithinCatchParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); } WriteEmbeddedStatement(catchClause.StatementBlock); @@ -1664,7 +1752,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinCheckedExpressionParantheses) { + outputFormatter.Space(); + } PrintStatementInline(fixedStatement.PointerDeclaration, data); + if (this.prettyPrintOptions.WithinCheckedExpressionParantheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); WriteEmbeddedStatement(fixedStatement.EmbeddedStatement); @@ -1711,6 +1805,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.PrintToken(Tokens.For); outputFormatter.Space(); outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinForParentheses) { + outputFormatter.Space(); + } if (forNextStatement.LoopVariableExpression.IsNull) { if (!forNextStatement.TypeReference.IsNull) { TrackVisit(forNextStatement.TypeReference, data); @@ -1757,6 +1854,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); TrackVisit(forNextStatement.Step, data); } + if (this.prettyPrintOptions.WithinForParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); WriteEmbeddedStatement(forNextStatement.EmbeddedStatement); @@ -1922,9 +2022,15 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinMethodCallParentheses) { + outputFormatter.Space(); + } TrackVisit(binaryOperatorExpression.Left, data); PrintFormattedComma(); TrackVisit(binaryOperatorExpression.Right, data); + if (this.prettyPrintOptions.WithinMethodCallParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); return null; case BinaryOperatorType.DictionaryAccess: @@ -2058,11 +2164,11 @@ namespace ICSharpCode.NRefactory.PrettyPrinter case BinaryOperatorType.Equality: case BinaryOperatorType.ReferenceEquality: - if (prettyPrintOptions.AroundRelationalOperatorParentheses) { + if (prettyPrintOptions.AroundEqualityOperatorParentheses) { outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.Equal); - if (prettyPrintOptions.AroundRelationalOperatorParentheses) { + if (prettyPrintOptions.AroundEqualityOperatorParentheses) { outputFormatter.Space(); } break; @@ -2086,11 +2192,11 @@ namespace ICSharpCode.NRefactory.PrettyPrinter break; case BinaryOperatorType.InEquality: case BinaryOperatorType.ReferenceInequality: - if (prettyPrintOptions.AroundRelationalOperatorParentheses) { + if (prettyPrintOptions.AroundEqualityOperatorParentheses) { outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.NotEqual); - if (prettyPrintOptions.AroundRelationalOperatorParentheses) { + if (prettyPrintOptions.AroundEqualityOperatorParentheses) { outputFormatter.Space(); } break; @@ -2133,7 +2239,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter public override object TrackedVisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression, object data) { outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinParentheses) { + outputFormatter.Space(); + } TrackVisit(parenthesizedExpression.Expression, data); + if (this.prettyPrintOptions.WithinParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); return null; } @@ -2147,7 +2259,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinMethodCallParentheses) { + outputFormatter.Space(); + } AppendCommaSeparatedList(invocationExpression.Arguments); + if (this.prettyPrintOptions.WithinMethodCallParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); return null; } @@ -2287,7 +2405,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinSizeOfParentheses) { + outputFormatter.Space(); + } TrackVisit(sizeOfExpression.TypeReference, data); + if (this.prettyPrintOptions.WithinSizeOfParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); return null; } @@ -2299,7 +2423,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinTypeOfParentheses) { + outputFormatter.Space(); + } TrackVisit(typeOfExpression.TypeReference, data); + if (this.prettyPrintOptions.WithinTypeOfParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); return null; } @@ -2311,7 +2441,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinTypeOfParentheses) { + outputFormatter.Space(); + } TrackVisit(defaultValueExpression.TypeReference, data); + if (this.prettyPrintOptions.WithinTypeOfParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); return null; } @@ -2338,7 +2474,14 @@ namespace ICSharpCode.NRefactory.PrettyPrinter if (anonymousMethodExpression.Parameters.Count > 0 || anonymousMethodExpression.HasParameterList) { outputFormatter.PrintToken(Tokens.OpenParenthesis); + bool withinParentheses = this.prettyPrintOptions.WithinMethodDeclarationParentheses && anonymousMethodExpression.Parameters.Any (); + if (withinParentheses) { + outputFormatter.Space(); + } AppendCommaSeparatedList(anonymousMethodExpression.Parameters); + if (withinParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); } OutputBlockAllowInline(anonymousMethodExpression.Body, this.prettyPrintOptions.MethodBraceStyle, false); @@ -2352,7 +2495,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.PrintIdentifier(lambdaExpression.Parameters[0].ParameterName); } else { outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinParentheses) { + outputFormatter.Space(); + } AppendCommaSeparatedList(lambdaExpression.Parameters); + if (this.prettyPrintOptions.WithinParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); } outputFormatter.Space(); @@ -2375,7 +2524,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinCheckedExpressionParantheses) { + outputFormatter.Space(); + } TrackVisit(checkedExpression.Expression, data); + if (this.prettyPrintOptions.WithinCheckedExpressionParantheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); return null; } @@ -2387,7 +2542,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinCheckedExpressionParantheses) { + outputFormatter.Space(); + } TrackVisit(uncheckedExpression.Expression, data); + if (this.prettyPrintOptions.WithinCheckedExpressionParantheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); return null; } @@ -2420,7 +2581,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter TrackVisit(castExpression.CastTo, data); } else { outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (prettyPrintOptions.WithinCastParentheses) { + outputFormatter.Space(); + } TrackVisit(castExpression.CastTo, data); + if (prettyPrintOptions.WithinCastParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); if (this.prettyPrintOptions.SpacesAfterTypecast) { outputFormatter.Space(); @@ -2485,7 +2652,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinMethodCallParentheses) { + outputFormatter.Space(); + } AppendCommaSeparatedList(objectCreateExpression.Parameters); + if (this.prettyPrintOptions.WithinMethodCallParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); } if (!objectCreateExpression.ObjectInitializer.IsNull) { @@ -2537,9 +2710,15 @@ namespace ICSharpCode.NRefactory.PrettyPrinter if (target is BinaryOperatorExpression || target is CastExpression) { outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinMethodCallParentheses) { + outputFormatter.Space(); + } } TrackVisit(target, data); if (target is BinaryOperatorExpression || target is CastExpression) { + if (this.prettyPrintOptions.WithinMethodCallParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); } outputFormatter.PrintToken(Tokens.Dot); diff --git a/main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/OutputFormatter.cs b/main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/OutputFormatter.cs index 252e10a9b5..d92f68c618 100644 --- a/main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/OutputFormatter.cs +++ b/main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/OutputFormatter.cs @@ -2,7 +2,7 @@ // <copyright see="prj:///doc/copyright.txt"/> // <license see="prj:///doc/license.txt"/> // <owner name="Mike Krüger" email="mike@icsharpcode.net"/> -// <version>$Revision: 1965 $</version> +// <version>$Revision: 3849 $</version> // </file> using System.Collections; @@ -52,6 +52,12 @@ namespace ICSharpCode.NRefactory.PrettyPrinter if (indent) ++IndentationLevel; break; + case BraceStyle.EndOfLineWithoutSpace: + PrintToken(Tokens.OpenCurlyBrace); + NewLine(); + if (indent) + ++IndentationLevel; + break; case BraceStyle.NextLine: NewLine(); Indent(); @@ -86,6 +92,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter BraceStyle style = (BraceStyle)braceStack.Pop(); switch (style) { case BraceStyle.EndOfLine: + case BraceStyle.EndOfLineWithoutSpace: case BraceStyle.NextLine: if (indent) --IndentationLevel; diff --git a/main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/PrettyPrintOptions.cs b/main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/PrettyPrintOptions.cs index d517b4322e..22b4902ebf 100644 --- a/main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/PrettyPrintOptions.cs +++ b/main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/PrettyPrintOptions.cs @@ -2,13 +2,14 @@ // <copyright see="prj:///doc/copyright.txt"/> // <license see="prj:///doc/license.txt"/> // <owner name="Mike Krüger" email="mike@icsharpcode.net"/> -// <version>$Revision: 3848 $</version> +// <version>$Revision: 3849 $</version> // </file> namespace ICSharpCode.NRefactory.PrettyPrinter { public enum BraceStyle { EndOfLine, + EndOfLineWithoutSpace, NextLine, NextLineShifted, NextLineShifted2 @@ -339,6 +340,8 @@ namespace ICSharpCode.NRefactory.PrettyPrinter #endregion + #region Spaces + #region Before Parentheses bool beforeMethodCallParentheses = false; bool beforeDelegateDeclarationParentheses = false; @@ -590,6 +593,159 @@ namespace ICSharpCode.NRefactory.PrettyPrinter } #endregion + #region WithinParentheses + bool withinCheckedExpressionParantheses = false; + public bool WithinCheckedExpressionParantheses { + get { + return withinCheckedExpressionParantheses; + } + set { + withinCheckedExpressionParantheses = value; + } + } + + bool withinTypeOfParentheses = false; + public bool WithinTypeOfParentheses { + get { + return withinTypeOfParentheses; + } + set { + withinTypeOfParentheses = value; + } + } + + bool withinSizeOfParentheses = false; + public bool WithinSizeOfParentheses { + get { + return withinSizeOfParentheses; + } + set { + withinSizeOfParentheses = value; + } + } + + bool withinCastParentheses = false; + public bool WithinCastParentheses { + get { + return withinCastParentheses; + } + set { + withinCastParentheses = value; + } + } + + bool withinUsingParentheses = false; + public bool WithinUsingParentheses { + get { + return withinUsingParentheses; + } + set { + withinUsingParentheses = value; + } + } + + bool withinLockParentheses = false; + public bool WithinLockParentheses { + get { + return withinLockParentheses; + } + set { + withinLockParentheses = value; + } + } + + bool withinSwitchParentheses = false; + public bool WithinSwitchParentheses { + get { + return withinSwitchParentheses; + } + set { + withinSwitchParentheses = value; + } + } + + bool withinCatchParentheses = false; + public bool WithinCatchParentheses { + get { + return withinCatchParentheses; + } + set { + withinCatchParentheses = value; + } + } + + bool withinForEachParentheses = false; + public bool WithinForEachParentheses { + get { + return withinForEachParentheses; + } + set { + withinForEachParentheses = value; + } + } + + bool withinForParentheses = false; + public bool WithinForParentheses { + get { + return withinForParentheses; + } + set { + withinForParentheses = value; + } + } + + bool withinWhileParentheses = false; + public bool WithinWhileParentheses { + get { + return withinWhileParentheses; + } + set { + withinWhileParentheses = value; + } + } + + bool withinIfParentheses = false; + public bool WithinIfParentheses { + get { + return withinIfParentheses; + } + set { + withinIfParentheses = value; + } + } + + bool withinMethodDeclarationParentheses = false; + public bool WithinMethodDeclarationParentheses { + get { + return withinMethodDeclarationParentheses; + } + set { + withinMethodDeclarationParentheses = value; + } + } + + bool withinMethodCallParentheses = false; + public bool WithinMethodCallParentheses { + get { + return withinMethodCallParentheses; + } + set { + withinMethodCallParentheses = value; + } + } + + bool withinParentheses = false; + public bool WithinParentheses { + get { + return withinParentheses; + } + set { + withinParentheses = value; + } + } + + #endregion + #region SpacesInConditionalOperator bool conditionalOperatorBeforeConditionSpace = true; bool conditionalOperatorAfterConditionSpace = true; @@ -632,12 +788,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter #endregion #region OtherSpaces - bool spacesWithinBrackets = false; bool spacesAfterComma = true; - bool spacesBeforeComma = false; - bool spacesAfterSemicolon = true; - bool spacesAfterTypecast = false; - public bool SpacesAfterComma { get { return spacesAfterComma; @@ -646,6 +797,8 @@ namespace ICSharpCode.NRefactory.PrettyPrinter spacesAfterComma = value; } } + + bool spacesAfterSemicolon = true; public bool SpacesAfterSemicolon { get { return spacesAfterSemicolon; @@ -654,6 +807,8 @@ namespace ICSharpCode.NRefactory.PrettyPrinter spacesAfterSemicolon = value; } } + + bool spacesAfterTypecast = false; public bool SpacesAfterTypecast { get { return spacesAfterTypecast; @@ -662,6 +817,8 @@ namespace ICSharpCode.NRefactory.PrettyPrinter spacesAfterTypecast = value; } } + + bool spacesBeforeComma = false; public bool SpacesBeforeComma { get { return spacesBeforeComma; @@ -670,6 +827,8 @@ namespace ICSharpCode.NRefactory.PrettyPrinter spacesBeforeComma = value; } } + + bool spacesWithinBrackets = false; public bool SpacesWithinBrackets { get { return spacesWithinBrackets; @@ -679,6 +838,6 @@ namespace ICSharpCode.NRefactory.PrettyPrinter } } #endregion - + #endregion } }
\ No newline at end of file |