@@ -84,16 +84,16 @@ export class ParamHintCompletionProvider extends CompletionProvider implements C
8484 const items : CompletionItem [ ] = [ ] ;
8585 const line = doc . lineAt ( pos ) ;
8686 const precedingText = line . text . substring ( 0 , pos . character - 1 ) . trim ( ) ;
87-
88- if ( this . shouldProvideItems ( precedingText , pos , doc ) ) {
87+
88+ if ( this . shouldProvideItems ( precedingText , pos , doc ) && ! token . isCancellationRequested ) {
8989 const param = this . getParam ( precedingText ) ;
9090 const documentText = doc . getText ( ) ;
9191 const typeContainer = getDataTypeContainer ( ) ;
9292 const provider = new TypeHintProvider ( typeContainer ) ;
9393 const wsSearcher = new WorkspaceSearcher ( doc . uri , this . settings , typeContainer ) ;
9494 let estimations : string [ ] = [ ] ;
9595
96- if ( param ) {
96+ if ( param && ! token . isCancellationRequested ) {
9797 const workspaceHintSearch = this . settings . workspaceSearchEnabled
9898 ? this . workspaceHintSearch ( param , wsSearcher , documentText )
9999 : null ;
@@ -106,6 +106,10 @@ export class ParamHintCompletionProvider extends CompletionProvider implements C
106106 } catch {
107107 }
108108
109+ if ( token . isCancellationRequested ) {
110+ wsSearcher . cancel ( ) ;
111+ return Promise . resolve ( null ) ;
112+ }
109113 this . pushHintsToItems ( provider . remainingTypeHints ( ) , items , estimations . length === 0 ) ;
110114 this . itemSortPrefix ++ ;
111115 this . pushHintsToItems ( provider . remainingTypingHints ( ) , items , false ) ;
0 commit comments