Browse Source

* Src/PrettyPrinter/CSharp/OutputFormatter.cs:

* Src/PrettyPrinter/AbstractOutputFormatter.cs: Corrected block
  comment output.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@4324 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Mike Krüger 17 years ago
parent
commit
64ef2a35f7
  1. 8
      src/Libraries/NRefactory/Project/Src/PrettyPrinter/AbstractOutputFormatter.cs
  2. 7
      src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/OutputFormatter.cs

8
src/Libraries/NRefactory/Project/Src/PrettyPrinter/AbstractOutputFormatter.cs

@ -70,6 +70,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -70,6 +70,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
this.prettyPrintOptions = prettyPrintOptions;
}
internal bool isIndented = false;
public void Indent()
{
if (DoIndent) {
@ -86,17 +87,20 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -86,17 +87,20 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
++indent;
}
}
isIndented = true;
}
}
public void Reset ()
{
text.Length = 0;
isIndented = false;
}
public void Space()
{
text.Append(' ');
isIndented = false;
}
internal int lastLineStart = 0;
@ -122,6 +126,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -122,6 +126,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
}
text.AppendLine();
lastLineStart = text.Length;
isIndented = false;
}
}
@ -164,6 +169,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -164,6 +169,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
lineBeforeLastStart = lastLineStart;
lastLineStart = text.Length;
}
isIndented = false;
}
/// <summary>
@ -175,6 +181,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -175,6 +181,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
lineBeforeLastStart = text.Length;
text.Append(specialText);
lastLineStart = text.Length;
isIndented = false;
}
public void PrintTokenList(ArrayList tokenList)
@ -209,6 +216,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -209,6 +216,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
public void PrintText(string text)
{
this.text.Append(text);
isIndented = false;
}
public abstract void PrintIdentifier(string identifier);

7
src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/OutputFormatter.cs

@ -137,11 +137,18 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -137,11 +137,18 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
{
switch (comment.CommentType) {
case CommentType.Block:
bool wasIndented = isIndented;
if (!wasIndented) {
Indent ();
}
if (forceWriteInPreviousBlock) {
WriteInPreviousLine("/*" + comment.CommentText + "*/", forceWriteInPreviousBlock);
} else {
PrintSpecialText("/*" + comment.CommentText + "*/");
}
if (wasIndented) {
Indent ();
}
break;
case CommentType.Documentation:
WriteLineInPreviousLine("///" + comment.CommentText, forceWriteInPreviousBlock);

Loading…
Cancel
Save