From e3c40ba7f39a7741a8418db393bf6c1e2d2886c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Fri, 24 May 2013 08:12:31 +0200 Subject: [PATCH] Fixed xml doc formatting bug. --- .../Formatter/FormattingVisitor_Global.cs | 4 ++-- .../TestTypeLevelIndentation.cs | 23 ++++++++++++++++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs b/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs index 633371605c..daedfd6e9e 100644 --- a/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs +++ b/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs @@ -120,10 +120,10 @@ namespace ICSharpCode.NRefactory.CSharp void FixAttributesAndDocComment(EntityDeclaration entity) { - var node =entity.FirstChild; + var node = entity.FirstChild; while (node != null && node.Role == Roles.Comment) { - FixIndentation(node); node = node.GetNextSibling(NoWhitespacePredicate); + FixIndentation(node); } if (entity.Attributes.Count > 0) { AstNode n = null; diff --git a/ICSharpCode.NRefactory.Tests/FormattingTests/TestTypeLevelIndentation.cs b/ICSharpCode.NRefactory.Tests/FormattingTests/TestTypeLevelIndentation.cs index ca82ab0406..5325697972 100644 --- a/ICSharpCode.NRefactory.Tests/FormattingTests/TestTypeLevelIndentation.cs +++ b/ICSharpCode.NRefactory.Tests/FormattingTests/TestTypeLevelIndentation.cs @@ -101,10 +101,27 @@ class Test { { CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono(); policy.ClassBraceStyle = BraceStyle.DoNotChange; - + + Test(policy, + @" class Test {}", + @"class Test {}"); + } + + [Test] + public void TestClassIndentationWithDocComment() + { + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono(); + policy.ClassBraceStyle = BraceStyle.DoNotChange; + Test(policy, - @" class Test {}", - @"class Test {}"); + @"/// + /// olwcowcolwc + /// + class Test {}", + @"/// +/// olwcowcolwc +/// +class Test {}"); } [Test]