import { of } from 'rxjs' ; import { delay } from 'rxjs/operators' ; import { ActionsProvider , HoverProvider , DocumentHighlightProvider } from '../hoverifier' ; import { HoverAttachment , DocumentHighlight } from '../types' ; import { MaybeLoadingResult } from '../loading' ; param hover export const createHoverAttachment = ( hover = { } ) : HoverAttachment => ( { range : hover . range ? hover . range : { start : { line : 24 , character : 10 } , end : { line : 24 , character : 14 } , } , } ) ; param documentHighlight export const createDocumentHighlight = ( documentHighlight = { } ) : DocumentHighlight => ( { range : documentHighlight . range ?? { start : { line : 24 , character : 10 } , end : { line : 24 , character : 14 } , } , } ) ; param hover param delayTime export function createStubHoverProvider ( hover = { } , delayTime ? ) { return ( ) => of < MaybeLoadingResult < { } > > ( { isLoading : false , result : createHoverAttachment ( hover ) } ) . pipe ( delay ( delayTime ?? 0 ) ) ; } param documentHighlights param delayTime export function createStubDocumentHighlightProvider ( documentHighlights = [ ] , delayTime ? ) { return ( ) => of < DocumentHighlight [ ] > ( documentHighlights . map ( createDocumentHighlight ) ) . pipe ( delay ( delayTime ?? 0 ) ) ; } template A param actions param delayTime export function createStubActionsProvider < A > ( actions , delayTime ? ) { return ( ) => of ( actions ) . pipe ( delay ( delayTime ?? 0 ) ) ; }