From 0cafc679f2141b469bb4e65d3007facd640e2c69 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Fri, 12 Jul 2019 16:56:23 +0200 Subject: [PATCH] Do not fold using declarations, if there's only one. --- .../Output/TextTokenWriter.cs | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/ICSharpCode.Decompiler/Output/TextTokenWriter.cs b/ICSharpCode.Decompiler/Output/TextTokenWriter.cs index 268b09ba3..f19c8cfda 100644 --- a/ICSharpCode.Decompiler/Output/TextTokenWriter.cs +++ b/ICSharpCode.Decompiler/Output/TextTokenWriter.cs @@ -90,7 +90,7 @@ namespace ICSharpCode.Decompiler return; } - if (firstUsingDeclaration) { + if (firstUsingDeclaration && !lastUsingDeclaration) { output.MarkFoldStart(defaultCollapsed: !settings.ExpandUsingDeclarations); firstUsingDeclaration = false; } @@ -264,11 +264,10 @@ namespace ICSharpCode.Decompiler public override void NewLine() { - if (lastUsingDeclaration) { + if (!firstUsingDeclaration && lastUsingDeclaration) { output.MarkFoldEnd(); lastUsingDeclaration = false; } -// lastEndOfLine = output.Location; output.WriteLine(); } @@ -366,9 +365,6 @@ namespace ICSharpCode.Decompiler } } -// Stack startLocations = new Stack(); -// Stack symbolsStack = new Stack(); - public override void StartNode(AstNode node) { if (nodeStack.Count == 0) { @@ -381,15 +377,6 @@ namespace ICSharpCode.Decompiler } } 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() != null) { -// symbolsStack.Push(node.Annotation()); -// symbolsStack.Peek().StartLocation = startLocations.Peek(); -// } } private bool IsUsingDeclaration(AstNode node)