11import { combineLatest , from , Observable } from 'rxjs'
2- import { map , switchMap } from 'rxjs/operators'
2+ import { catchError , map , switchMap } from 'rxjs/operators'
33import { HoverMerged } from '../../client/types/hover'
44import { TextDocumentPositionParams , TextDocumentRegistrationOptions } from '../../protocol'
55import { Hover } from '../../protocol/plainTypes'
@@ -14,14 +14,20 @@ export class TextDocumentHoverProviderRegistry extends FeatureProviderRegistry<
1414 TextDocumentRegistrationOptions ,
1515 ProvideTextDocumentHoverSignature
1616> {
17+ /**
18+ * Returns an observable that emits all providers' hovers whenever any of the last-emitted set of providers emits
19+ * hovers. If any provider emits an error, the error is logged and the provider is omitted from the emission of
20+ * the observable (the observable does not emit the error).
21+ */
1722 public getHover ( params : TextDocumentPositionParams ) : Observable < HoverMerged | null > {
1823 return getHover ( this . providers , params )
1924 }
2025}
2126
2227/**
2328 * Returns an observable that emits all providers' hovers whenever any of the last-emitted set of providers emits
24- * hovers.
29+ * hovers. If any provider emits an error, the error is logged and the provider is omitted from the emission of
30+ * the observable (the observable does not emit the error).
2531 *
2632 * Most callers should use TextDocumentHoverProviderRegistry's getHover method, which uses the registered hover
2733 * providers.
@@ -36,7 +42,18 @@ export function getHover(
3642 if ( providers . length === 0 ) {
3743 return [ [ null ] ]
3844 }
39- return combineLatest ( providers . map ( provider => from ( provider ( params ) ) ) )
45+ return combineLatest (
46+ providers . map ( provider =>
47+ from (
48+ provider ( params ) . pipe (
49+ catchError ( err => {
50+ console . error ( err )
51+ return [ null ]
52+ } )
53+ )
54+ )
55+ )
56+ )
4057 } )
4158 )
4259 . pipe ( map ( HoverMerged . from ) )
0 commit comments