From 214d2ea27594a37de1d31173bfcd89e76baf4268 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Fri, 17 May 2013 12:04:48 +0200 Subject: [PATCH] Fixed formatting bug. --- .../Formatter/FormattingVisitor_Global.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs b/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs index d84f49c224..633371605c 100644 --- a/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs +++ b/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs @@ -80,6 +80,9 @@ namespace ICSharpCode.NRefactory.CSharp bool first = true; bool startFormat = false; VisitChildrenToFormat(namespaceDeclaration, child => { + if (first) { + startFormat = child.StartLocation > namespaceDeclaration.LBraceToken.StartLocation; + } if (child.Role == Roles.LBrace) { var next = child.GetNextSibling(NoWhitespacePredicate); var blankLines = 1; @@ -169,8 +172,13 @@ namespace ICSharpCode.NRefactory.CSharp if (indentBody) curIndent.Push(IndentType.Block); - bool startFormat = false; + bool startFormat = true; + bool first = true; VisitChildrenToFormat(typeDeclaration, child => { + if (first) { + startFormat = child.StartLocation > typeDeclaration.LBraceToken.StartLocation; + first = false; + } if (child.Role == Roles.LBrace) { startFormat = true; return;