Skip to content
Snippets Groups Projects

Code intel: only show the "Find references" button when a definition is found

Merged Warren Gifford requested to merge hide-find-references-until-definition into master

Created by: chrismwendt

Prior to this change, the "Find references" button would show up everywhere: on whitespace, comments, and punctuation.

2019-04-02 19 30 16

After this change, the "Find references" button will only appear when a definition is found.

2019-04-02 19 41 22

Pros/cons:

  • Pro: "Find references" will never appear by itself, and will likely be accompanied by a hover tooltip
  • Pro: "Find references" won't show up on whitespace or punctuation
  • Con: you won't be able to find references on legitimate tokens for which a definition couldn't be found (basic-code-intel is susceptible to this, language servers less so)
  • Con: "Find references" won't show up until the definition is found (currently it shows up after a delay even if the definition is still loading)

Alternatively, this could be implemented by adding hasReferences(pos): boolean to the Sourcegraph extension API, which would give more control to extensions. The implementation in this PR was dead easy, so I thought I'd propose it first.

Code nav team (@lguychard @felixfbecker @vanesa) I'm curious if you have thoughts on this :thought_balloon:

Merge request reports

Merged by avatar (Jul 12, 2025 5:14pm UTC)

Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading