Code intel: only show the "Find references" button when a definition is found
Created by: chrismwendt
Prior to this change, the "Find references" button would show up everywhere: on whitespace, comments, and punctuation.
After this change, the "Find references" button will only appear when a definition is found.
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