@@ -517,24 +517,30 @@ export class SuggestionProvider implements SuggestionProviderInterface {
517517 ) ;
518518 }
519519
520- show ( suggestionId : string , uri : vscode . Uri , position : vscode . Range ) : void {
521- if ( ! this . extension ) return this . checkPanelAndDispose ( ) ;
520+ show ( suggestionId : string , uri : vscode . Uri , position : vscode . Range ) {
521+ if ( ! this . extension ) {
522+ this . disposePanel ( ) ;
523+ return ;
524+ }
522525 const suggestion = this . extension . analyzer . getFullSuggestion ( suggestionId , uri , position ) ;
523- if ( ! suggestion ) return this . checkPanelAndDispose ( ) ;
526+ if ( ! suggestion ) {
527+ this . disposePanel ( ) ;
528+ return ;
529+ }
524530 this . showPanel ( suggestion ) ;
525531 }
526532
527- checkCurrentSuggestion ( ) : void {
533+ checkCurrentSuggestion ( ) {
528534 if ( ! this . panel || ! this . suggestion || ! this . extension ) return ;
529535 const found = this . extension . analyzer . checkFullSuggestion ( this . suggestion ) ;
530- if ( ! found ) return this . checkPanelAndDispose ( ) ;
536+ if ( ! found ) this . disposePanel ( ) ;
531537 }
532538
533- private checkPanelAndDispose ( ) {
539+ private disposePanel ( ) {
534540 if ( this . panel ) this . panel . dispose ( ) ;
535541 }
536542
537- private disposePanel ( ) {
543+ private onPanelDispose ( ) {
538544 this . panel = undefined ;
539545 }
540546
@@ -598,7 +604,7 @@ export class SuggestionProvider implements SuggestionProviderInterface {
598604 this . panel . webview . html = getWebviewContent ( images ) ;
599605 this . panel . webview . postMessage ( { type : 'set' , args : suggestion } ) ;
600606 this . panel . onDidDispose (
601- this . disposePanel . bind ( this ) ,
607+ this . onPanelDispose . bind ( this ) ,
602608 null ,
603609 this . extension ?. context ?. subscriptions
604610 ) ;
0 commit comments