Browse Source

Skip debug-step node tracking on normal decompiles

NodeLookup population runs per AST node (and per annotation) on every on-screen
C# decompile, but the debug-step highlighter only consumes it when a step limit
is set. Gate the node-tracking token writer on StepLimit so the common Release
path skips the bookkeeping; AvaloniaEditTextOutput is an ISmartTextOutput, so it
still gets full syntax highlighting via the existing branch.

Assisted-by: Claude:claude-opus-4-8:Claude Code
pull/3847/head
Siegfried Pammer 7 days ago committed by Siegfried Pammer
parent
commit
07ead4fe33
  1. 6
      ILSpy/Languages/CSharpLanguage.cs

6
ILSpy/Languages/CSharpLanguage.cs

@ -713,7 +713,11 @@ namespace ICSharpCode.ILSpy.Languages @@ -713,7 +713,11 @@ namespace ICSharpCode.ILSpy.Languages
syntaxTree.AcceptVisitor(new InsertParenthesesVisitor { InsertParenthesesForReadability = true });
output.IndentationString = settings.CSharpFormattingOptions.IndentationString;
TokenWriter tokenWriter = new TextTokenWriter(output, settings);
if (output is TextView.AvaloniaEditTextOutput avaloniaOutput)
// Node-range tracking (NodeLookup) is only consumed by the debug-step highlighter, which
// resolves nothing without a step limit. Skip it on a normal decompile so the common path
// doesn't pay the per-node/per-annotation bookkeeping; AvaloniaEditTextOutput is an
// ISmartTextOutput, so the branch below still gives it full syntax highlighting.
if (output is TextView.AvaloniaEditTextOutput avaloniaOutput && options.StepLimit != int.MaxValue)
tokenWriter = new CSharpHighlightingTokenWriter(tokenWriter, avaloniaOutput);
else if (output is TextView.ISmartTextOutput smartOutput)
tokenWriter = new CSharpHighlightingTokenWriter(tokenWriter, smartOutput);

Loading…
Cancel
Save