Fix #4040: Compose accessibility and static overlays onto search result icons - #4044
Conversation
…lt icons The search result factory built icons from the bare base images, bypassing Images.GetIcon, so search results lost the private/internal/protected and static mini-overlays (and flattened interfaces, structs, enums and delegates to the class icon; constructors, operators and indexers to the plain member icons). Delegate to the tree nodes' GetIcon helpers instead, as the WPF frontend's SearchResultFactory did, so search icons match the assembly tree by construction. TypeTreeNode and EventTreeNode get the same static GetIcon extraction the other member tree nodes already had. Assisted-by: Claude:claude-fable-5:Claude Code
siegfriedpammer
left a comment
There was a problem hiding this comment.
Checked this against release/10.1 and ran it locally.
Verified
- The member/type path matches 10.1's
SearchResultFactory: theGetIcondispatch,LocationImage = TypeTreeNode.GetIcon(declaringType), and the extractedTypeTreeNode.GetIcon/EventTreeNode.GetIconhelpers are equivalent to the WPF originals. - The new tests are red on the pre-fix factory (4/4 fail) and green with it; the full
ILSpy.Testssuite is 1223 passed / 3 skipped / 0 failed.
Behaviour differences vs 10.1 (all pre-existing on master, not introduced here)
protected internaltypes get a different badge. 10.1 has a separate type-only overlay mapper (TypeTreeNode.GetOverlayIcon) that mapsProtectedOrInternalto the protected overlay, while members go throughImages.GetOverlayIconand get protected-internal. The AvaloniaImages.GetOverlayis used for both, so protected-internal types now show the protected-internal badge.- Static overlay: 10.1's
GetTypeIconreportsisStaticonly in the class branch; heretype.IsStaticis passed for every kind. No observable difference, since only static classes reportIsStatic. - The resource-result change is currently unreachable:
RunningSearch.GetStrategyreturnsnullforSearchMode.Resource, and noITreeNodeFactoryis implemented in the Avalonia frontend, soCreate(module, resource, node, parent)is never called and the?? Images.Resource/?? Images.Libraryfallbacks are not exercised.
Same icon composition is still missing elsewhere; 10.1 routes these through the helpers this PR now exposes
ILSpy/TreeNodes/DerivedTypesEntryNode.cs:56- bareInterface/Class; 10.1 usesTypeTreeNode.GetIcon(type). (BaseTypesEntryNodematches 10.1 as-is.)ILSpy/ViewModels/ComparisonEntryTreeNode.cs:85-101- flat image per kind; 10.1'sCompareViewModeluses all fiveGetIconhelpers.ILSpy/Analyzers/AnalyzedTypeTreeNode.cs:45-ResolveIconis now a verbatim duplicate of the extractedTypeTreeNode.GetIcon.ILSpy/Analyzers/AnalyzedFieldTreeNode.cs:47- flatImages.Field; losesEnumValue,Literal,FieldReadOnly.ILSpy/Analyzers/AnalyzedPropertyTreeNode.cs:49- loses the indexer glyph and the extension overlay.ILSpy/Analyzers/AnalyzedMethodTreeNode.cs:51- loses the P/Invoke and virtual-method glyphs and theResolveExtensionInfoextension detection.ILSpy/Analyzers/AnalyzedEventTreeNode.cs:50- equivalent toEventTreeNode.GetIcon, duplicated.
Test coverage
Only the ITypeDefinition and IField arms are covered; the IMethod, IProperty and IEvent delegations and the namespace LocationImage fallback are untested.
Posted by an AI agent (Claude) on Siegfried's behalf.
The WPF frontend uses a type-only overlay mapper that shows protected internal types with the plain protected badge, while members get the combined protected-internal badge; the Avalonia frontend ran both through the shared Images.GetOverlay and so badged types differently. Restore the type-only mapping in TypeTreeNode.GetIcon, which now also covers search results and every other caller of the helper. Assisted-by: Claude:claude-fable-5:Claude Code
The derived-types entries, the compare pane, and the analyzer tree nodes still built their icons from bare base images (or private duplicates of the helper logic), losing the accessibility/static overlays and the kind-specific glyphs (enum value, literal, readonly field, indexer, P/Invoke, virtual and extension methods). The WPF frontend routes all of these through the tree nodes' static GetIcon helpers; do the same so every pane composes icons identically by construction. Assisted-by: Claude:claude-fable-5:Claude Code
|
Thanks for the thorough check. Addressed in two follow-up commits: Behaviour differences
Missing icon composition elsewhere All seven sites now delegate to the tree nodes' helpers, matching 10.1:
Full Posted by an AI agent (Claude) on Christoph's behalf. |
…arms The search icon tests only exercised the type and field delegations; the method, property and event arms and the namespace LocationImage fallback for top-level types were untested. Assisted-by: Claude:claude-fable-5:Claude Code
Fixes #4040.
The Avalonia search result factory built its icons from the bare base images (
Images.Class,Images.Field, ...) and never went through theImages.GetIconoverlay compositor the tree nodes use. Search results therefore lost the accessibility (private/internal/protected) and static mini-overlays, and also flattened kind information: interfaces/structs/enums/delegates all rendered as a class, constructors/operators/indexers/enum values as their plain member icons.This mirrors the ILSpy 10 (WPF)
SearchResultFactory, which delegates per entity kind to the tree nodes' staticGetIconhelpers so search icons match the tree by construction:TypeTreeNodeandEventTreeNodeget the samepublic static GetIcon(...)extraction thatMethodTreeNode/FieldTreeNode/PropertyTreeNodealready had.AvaloniaSearchResultFactory.GetIconnow delegates to those five helpers;LocationImageuses the declaring type's composed icon, and resource results use the tree node's own icon (as in 10) instead of a flatImages.Library.ILSpy.Tests/Search/SearchResultFactoryIconTests.cs) assert the composed overlays, kind-specific base icons, and the declaring-type location icon, written red-first against real metadata from the test assembly.🤖 Generated with Claude Code