Skip to content

Re-reveal reference selection in peek preview on repeat tree click#316833

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-ref-tree-item-click
Draft

Re-reveal reference selection in peek preview on repeat tree click#316833
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-ref-tree-item-click

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 17, 2026

In the Go to References zone widget, clicking an already-selected item in the references tree was a no-op. If the user had scrolled the preview editor away from the highlighted reference, there was no way to bring it back into view short of selecting a different reference first.

Changes

  • referencesWidget.ts — In ReferenceWidget._revealReference, the early-return on this._revealedReference === reference previously short-circuited all work. It now re-applies the selection and re-centers the range in the preview editor on repeat clicks, while still skipping the expensive work (model resolution, title update, tree reveal) since that state is already correct.
if (this._revealedReference === reference) {
    const model = this._preview.getModel();
    if (model) {
        const sel = Range.lift(reference.range).collapseToStart();
        this._preview.setSelection(sel);
        this._preview.revealRangeInCenter(sel, ScrollType.Smooth);
    }
    return;
}

The new path mirrors the existing first-reveal logic (setSelection + revealRangeInCenter) and uses ScrollType.Smooth since the preview model is unchanged.

Copilot AI requested review from Copilot and removed request for Copilot May 17, 2026 01:33
Copilot AI linked an issue May 17, 2026 that may be closed by this pull request
Co-authored-by: dmitrivMS <9581278+dmitrivMS@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot May 17, 2026 01:40
Copilot AI changed the title [WIP] Fix ref tree item in zone widget for repeat clicks Re-reveal reference selection in peek preview on repeat tree click May 17, 2026
Copilot AI requested a review from dmitrivMS May 17, 2026 01:40
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.

Ref tree item in zone widget cannot repeat click

2 participants