Fix #781: click highlights member references, Ctrl+Click navigates - #3923
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an optional (default-off) interaction mode in the decompiler text view where a plain click highlights all occurrences of member/type references in the current document, while Ctrl+Click performs navigation; also updates cursor affordances and adds regression tests.
Changes:
- Introduces
DisplaySettings.HighlightMemberReferencesand surfaces it in the Display options UI (default: off). - Extends reference-click handling to highlight member/type references on plain click when enabled, with Ctrl+Click preserving navigation.
- Adds cursor-query plumbing (key-modifier aware) plus a new headless UI test suite covering highlighting, navigation, and cursor behavior.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| ILSpy/TextView/VisualLineReferenceText.cs | Delegates cursor selection to the host when available (modifier/settings-aware). |
| ILSpy/TextView/ReferenceElementGenerator.cs | Adds QueryCursor hook so the view can decide cursor behavior for references. |
| ILSpy/TextView/DecompilerTextView.axaml.cs | Implements highlight-vs-navigate toggle, Ctrl-modified navigation, and cursor update logic. |
| ILSpy/Properties/Resources.resx | Adds localized string for the new display setting label. |
| ILSpy/Properties/Resources.Designer.cs | Adds strongly-typed accessor for the new resource string. |
| ILSpy/Options/DisplaySettingsPanel.axaml | Adds checkbox to toggle member-reference click highlighting. |
| ILSpy/Options/DisplaySettings.cs | Adds persisted setting HighlightMemberReferences (default-off). |
| ILSpy/Options/DisplaySettingReactions.cs | Marks the new setting as EditorLive (no redecompile needed). |
| ILSpy.Tests/Editor/MemberReferenceHighlightTests.cs | Adds headless tests covering default-off behavior, highlight matching, Ctrl navigation, pointer events, and cursor affordance. |
Files not reviewed (1)
- ILSpy/Properties/Resources.Designer.cs: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Clicking a local variable highlights its occurrences, but clicking a member or type always navigated away, so there was no way to see all uses of a member within the current view. With the new display setting enabled (off by default, as discussed in the issue), a single click on a member or type reference paints every occurrence in the view using the local-reference highlight infrastructure, and Ctrl+Click performs the navigation. Opcode references keep navigating on plain click. Matching occurrences are compared by definition token and module rather than by Equals, because a use site carries a specialized member instance while the declaration carries the definition; this also fixes the analyzer-driven highlight for specialized members. Unresolved entity references from the IL and metadata views are compared structurally to avoid building a type system per click. The hand cursor promises navigation, so it is shown only when a click would actually navigate: cursor queries factor in the setting and the Ctrl state, and Ctrl presses/releases while hovering a reference repaint the cursor via top-level key handlers, since keyboard focus is usually elsewhere while hovering. Assisted-by: Claude:claude-fable-5:Claude Code
siegfriedpammer
force-pushed
the
feature-781-member-highlight
branch
from
July 28, 2026 12:31
0858774 to
2032766
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #781.
Clicking a local variable highlights its occurrences, but clicking a member or type always navigated away, so there was no way to see all uses of a member within the current view.
Behavior (per the implementation suggestions in the issue):
Matching: occurrences are compared by definition token and module rather than
Equals, because a use site carries a specialized member instance (List<int>.Add) while the declaration carries the definition — the same mismatch class as #2078. This also fixes the analyzer-driven highlight for specialized members. Unresolved entity references from the IL/metadata views are compared structurally (module + handle) to avoid building a type system per click.Tests:
MemberReferenceHighlightTests(8, red-first): default-off pin, highlight-all, specialized-member matching, type parameterization matching, Ctrl navigation, clear behavior, an end-to-end pointer test with realRawInputModifiers.Controlmouse events, and a cursor test asserting hand-only-when-navigating. Full ILSpy.Tests: 1077 passed / 3 skipped.🤖 This PR was prepared by an AI agent (Claude Code) operated by @siegfriedpammer.