1+ import { Position , Range } from '@sourcegraph/extension-api-types'
12import { isEqual } from 'lodash'
23import {
34 combineLatest ,
@@ -27,7 +28,6 @@ import {
2728 withLatestFrom ,
2829} from 'rxjs/operators'
2930import { Key } from 'ts-key-enum'
30- import { Position , Range } from 'vscode-languageserver-types'
3131import { asError , ErrorLike , isErrorLike } from './errors'
3232import { scrollIntoCenterIfNeeded } from './helpers'
3333import { HoverOverlayProps , isJumpURL } from './HoverOverlay'
@@ -42,7 +42,7 @@ import {
4242 getTokenAtPosition ,
4343 HoveredToken ,
4444} from './token_position'
45- import { HoverAttachment , isHoverAttachmentWithRange , LineOrPositionOrRange , LOADING } from './types'
45+ import { HoverAttachment , isHoverAttachmentWithRange , isPosition , LineOrPositionOrRange , LOADING } from './types'
4646
4747export { HoveredToken }
4848
@@ -437,7 +437,7 @@ export function createHoverifier<C extends object>({
437437 let cell : HTMLElement | null
438438 let target : HTMLElement | undefined
439439 let part : DiffPart | undefined
440- if ( Position . is ( position ) ) {
440+ if ( isPosition ( position ) ) {
441441 cell = dom . getCodeElementFromLineNumber ( codeView , position . line , position . part )
442442 if ( cell ) {
443443 target = findElementWithOffset ( cell , position . character )
@@ -479,7 +479,7 @@ export function createHoverifier<C extends object>({
479479 } )
480480 ) ,
481481 switchMap ( ( { position, codeView, adjustPosition, resolveContext, ...rest } ) => {
482- if ( ! position || ! Position . is ( position ) || ! adjustPosition ) {
482+ if ( ! position || ! isPosition ( position ) || ! adjustPosition ) {
483483 return of ( { position, codeView, ...rest } )
484484 }
485485
@@ -502,7 +502,7 @@ export function createHoverifier<C extends object>({
502502 // that tokens span multiple elements meaning that it's possible for the hover overlay to be
503503 // placed in the middle of a token.
504504 target :
505- position && Position . is ( position )
505+ position && isPosition ( position )
506506 ? getTokenAtPosition ( codeView , position , dom , position . part )
507507 : target ,
508508 ...rest ,
@@ -522,7 +522,7 @@ export function createHoverifier<C extends object>({
522522 map ( ( { position, resolveContext, eventType, ...rest } ) => ( {
523523 ...rest ,
524524 eventType,
525- position : Position . is ( position ) ? { ...position , ...resolveContext ( position ) } : undefined ,
525+ position : isPosition ( position ) ? { ...position , ...resolveContext ( position ) } : undefined ,
526526 } ) ) ,
527527 share ( )
528528 )
0 commit comments