Skip to content
This repository was archived by the owner on Nov 25, 2021. It is now read-only.

Commit 85c8612

Browse files
committed
feat: remove "Find references" button
1 parent 1836363 commit 85c8612

File tree

3 files changed

+1
-32
lines changed

3 files changed

+1
-32
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Adds code intelligence to code views on the web. Used in [Sourcegraph](https://s
1212

1313
- Listens to hover and click events on the code view
1414
- On mouse hovers, determines the line+column position, does an LSP hover request and renders it in a nice tooltip overlay at the token
15-
- Shows buttons for go-to-definition and find-references
15+
- Shows button for go-to-definition
1616
- When clicking a token, pins the tooltip to that token
1717
- Highlights the hovered token
1818

src/HoverOverlay.tsx

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,6 @@ export interface HoverOverlayProps<C = {}> {
4545
*/
4646
definitionURLOrError?: typeof LOADING | { jumpURL: string } | null | ErrorLike
4747

48-
/**
49-
* The URL to navigate to to view references.
50-
* If loaded, is set as the href of the find-references button.
51-
* If undefined or null, the button is disabled.
52-
*/
53-
referencesURL?: string | null
54-
5548
/** The position of the tooltip (assigned to `style`) */
5649
overlayPosition?: { left: number; top: number }
5750

@@ -89,7 +82,6 @@ const transformMouseEvent = (handler: (event: MouseEvent) => void) => (event: Re
8982

9083
export const HoverOverlay: <C>(props: HoverOverlayProps<C>) => React.ReactElement<any> = ({
9184
definitionURLOrError,
92-
referencesURL,
9385
hoveredToken,
9486
hoverOrError,
9587
hoverRef,
@@ -193,17 +185,6 @@ export const HoverOverlay: <C>(props: HoverOverlayProps<C>) => React.ReactElemen
193185
>
194186
Go to definition {definitionURLOrError === LOADING && <LoadingSpinner className="icon-inline" />}
195187
</ButtonOrLink>
196-
{hoveredToken &&
197-
referencesURL && (
198-
<ButtonOrLink
199-
linkComponent={linkComponent}
200-
// tslint:disable-next-line:jsx-no-lambda
201-
to={referencesURL}
202-
className="btn btn-secondary hover-overlay__action e2e-tooltip-find-refs"
203-
>
204-
Find references
205-
</ButtonOrLink>
206-
)}
207188
</div>
208189
{definitionURLOrError === null ? (
209190
<div className="alert alert-info hover-overlay__alert-below">

src/hoverifier.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ export interface HoverifierOptions<C extends object> {
8484

8585
fetchHover: HoverFetcher<C>
8686
fetchJumpURL: JumpURLFetcher<C>
87-
getReferencesURL: (hoverToken: HoveredToken & C) => string | null
8887
}
8988

9089
/**
@@ -211,7 +210,6 @@ export interface HoverState {
211210
interface InternalHoverifierState<C extends object> {
212211
hoverOrError?: typeof LOADING | HoverMerged | null | ErrorLike
213212
definitionURLOrError?: typeof LOADING | { jumpURL: string } | null | ErrorLike
214-
referencesURL?: string | null
215213

216214
hoverOverlayIsFixed: boolean
217215

@@ -263,7 +261,6 @@ const internalToExternalState = (internalState: InternalHoverifierState<{}>): Ho
263261
isJumpURL(internalState.definitionURLOrError) || internalState.clickedGoToDefinition
264262
? internalState.definitionURLOrError
265263
: undefined,
266-
referencesURL: internalState.referencesURL,
267264
hoveredToken: internalState.hoveredToken,
268265
showCloseButton: internalState.hoverOverlayIsFixed,
269266
}
@@ -307,15 +304,13 @@ export function createHoverifier<C extends object>({
307304
pushHistory,
308305
fetchHover,
309306
fetchJumpURL,
310-
getReferencesURL,
311307
}: HoverifierOptions<C>): Hoverifier<C> {
312308
// Internal state that is not exposed to the caller
313309
// Shared between all hoverified code views
314310
const container = createObservableStateContainer<InternalHoverifierState<C>>({
315311
hoverOverlayIsFixed: false,
316312
clickedGoToDefinition: false,
317313
definitionURLOrError: undefined,
318-
referencesURL: undefined,
319314
hoveredToken: undefined,
320315
hoverOrError: undefined,
321316
hoverOverlayPosition: undefined,
@@ -537,13 +532,6 @@ export function createHoverifier<C extends object>({
537532
distinctUntilChanged((a, b) => isEqual(a.position, b.position))
538533
)
539534

540-
/** Emits new referencesURL values. */
541-
subscription.add(
542-
resolvedPositions
543-
.pipe(map(({ position }) => (position ? getReferencesURL(position) : null)))
544-
.subscribe(referencesURL => container.update({ referencesURL }))
545-
)
546-
547535
/**
548536
* For every position, emits an Observable with new values for the `hoverOrError` state.
549537
* This is a higher-order Observable (Observable that emits Observables).

0 commit comments

Comments
 (0)