Skip to content

Syntax-colour analyzer signatures with bold type names (#2164) - #3812

Merged
siegfriedpammer merged 2 commits into
masterfrom
analyzer-rich-signatures
Jun 24, 2026
Merged

Syntax-colour analyzer signatures with bold type names (#2164)#3812
siegfriedpammer merged 2 commits into
masterfrom
analyzer-rich-signatures

Conversation

@siegfriedpammer

Copy link
Copy Markdown
Member

Fixes #2164.

The Analyze panel rendered each signature as a flat string, so the type names that carry the key information were hard to spot in long Used By / Uses lists. This renders analyzer entity rows as syntax-highlighted rich text with the type-name spans emboldened.

How

  • Language.GetRichTextTooltip(entity) becomes a general GetRichText(entity, conversionFlags, boldTypeNames). The hover tooltip is one caller, the analyzer pane another. C# colours the signature via CSharpHighlightingTokenWriter and bolds the type-name colour spans; IL renders its disassembled header (its signature form, already lexically highlighted); the base produces plain text. The IL method/type/field header is semantically the same artifact as the C# signature, so it shares the one method.
  • Rendering is opt-in. Nodes that want rich labels implement IRichTextNode; the single shared SharpTreeView cell renders their runs via a new RichNodeText attached behaviour, falling back to the plain Text otherwise. So no other tree is affected.
  • SharpTreeNode.Text stays the authoritative plain string, so search, copy and keyboard navigation are unchanged; analyzer entity nodes derive their Text from the same RichText so the two never diverge.
  • Theme- and language-reactive. The highlighted RichText is cached per (theme, language) and the cell re-renders rich rows on ThemeChanged and on language-settings changes, so existing analyzer results recolour on a theme toggle and reformat when the decompiler language is switched.

Tests

New headless AnalyzerRichTextTests cover the bold-type-name span and the plain-Text contract; the full ILSpy.Tests suite (888) passes unchanged, confirming the shared cell-template change does not regress the other trees / search / copy / navigation.

This PR was prepared with the assistance of an AI agent.

The Analyze panel showed each signature as a flat string, so the type names
that carry the key information were hard to spot in long Used-By / Uses lists.
Render analyzer entity rows as syntax-highlighted rich text with the type-name
spans emboldened (issue #2164).

Replace Language.GetRichTextTooltip(entity) with a general
GetRichText(entity, conversionFlags, boldTypeNames): the hover tooltip is one
caller, the analyzer pane another. C# colours the signature via
CSharpHighlightingTokenWriter and bolds the type-name colour spans; IL renders
its disassembled header (its signature form), already lexically highlighted;
the base produces plain text. The IL method/type/field header is semantically
the same artifact as the C# signature, so it shares the one method.

Rendering is opt-in: nodes that want rich labels implement IRichTextNode, and
the single shared SharpTreeView cell renders its runs via the new RichNodeText
attached behaviour, falling back to the plain Text otherwise. SharpTreeNode.Text
stays the authoritative plain string, so search, copy and keyboard navigation
are unchanged; analyzer entity nodes derive Text from the same RichText so the
two never diverge.

Fixes #2164

Assisted-by: Claude:claude-opus-4-8:Claude Code
The analyzer signature colours depend on the active theme, and the formatting
on the active language, but the highlighted RichText was built once and cached.
Toggling the theme or switching the decompiler language therefore left existing
analyzer results showing the old colours / syntax.

Key the node's RichText cache on the (theme, language) pair so it rebuilds when
either changes, and have the rich-text cell re-render rich rows on both
ThemeManager.ThemeChanged and the language settings' PropertyChanged (cleaned up
on Node change and on detach, like the existing subscriptions).

Assisted-by: Claude:claude-opus-4-8:Claude Code
@siegfriedpammer
siegfriedpammer merged commit 53121d7 into master Jun 24, 2026
13 checks passed
@siegfriedpammer
siegfriedpammer deleted the analyzer-rich-signatures branch June 27, 2026 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make type names (classes, structs, interfaces) in the Analyze panel bold or underline for better readability

1 participant