Browse Source

Do not fold using declarations, if there's only one.

pull/1596/head
Siegfried Pammer 6 years ago
parent
commit
0cafc679f2
  1. 17
      ICSharpCode.Decompiler/Output/TextTokenWriter.cs

17
ICSharpCode.Decompiler/Output/TextTokenWriter.cs

@ -90,7 +90,7 @@ namespace ICSharpCode.Decompiler
return; return;
} }
if (firstUsingDeclaration) { if (firstUsingDeclaration && !lastUsingDeclaration) {
output.MarkFoldStart(defaultCollapsed: !settings.ExpandUsingDeclarations); output.MarkFoldStart(defaultCollapsed: !settings.ExpandUsingDeclarations);
firstUsingDeclaration = false; firstUsingDeclaration = false;
} }
@ -264,11 +264,10 @@ namespace ICSharpCode.Decompiler
public override void NewLine() public override void NewLine()
{ {
if (lastUsingDeclaration) { if (!firstUsingDeclaration && lastUsingDeclaration) {
output.MarkFoldEnd(); output.MarkFoldEnd();
lastUsingDeclaration = false; lastUsingDeclaration = false;
} }
// lastEndOfLine = output.Location;
output.WriteLine(); output.WriteLine();
} }
@ -366,9 +365,6 @@ namespace ICSharpCode.Decompiler
} }
} }
// Stack<TextLocation> startLocations = new Stack<TextLocation>();
// Stack<MethodDebugSymbols> symbolsStack = new Stack<MethodDebugSymbols>();
public override void StartNode(AstNode node) public override void StartNode(AstNode node)
{ {
if (nodeStack.Count == 0) { if (nodeStack.Count == 0) {
@ -381,15 +377,6 @@ namespace ICSharpCode.Decompiler
} }
} }
nodeStack.Push(node); nodeStack.Push(node);
// startLocations.Push(output.Location);
// if (node is EntityDeclaration && node.GetSymbol() != null && node.GetChildByRole(Roles.Identifier).IsNull)
// output.WriteDefinition("", node.GetSymbol(), false);
// if (node.Annotation<MethodDebugSymbols>() != null) {
// symbolsStack.Push(node.Annotation<MethodDebugSymbols>());
// symbolsStack.Peek().StartLocation = startLocations.Peek();
// }
} }
private bool IsUsingDeclaration(AstNode node) private bool IsUsingDeclaration(AstNode node)

Loading…
Cancel
Save