@@ -348,11 +348,7 @@ export class ModelEditorView extends AbstractWebview<
348348 withProgress ( ( progress ) => this . loadMethods ( progress ) , {
349349 cancellable : false ,
350350 } ) ,
351- withProgress ( ( progress ) => this . loadAccessPathSuggestions ( progress ) , {
352- cancellable : false ,
353- location : ProgressLocation . Window ,
354- title : "Loading access path suggestions" ,
355- } ) ,
351+ this . loadAccessPathSuggestions ( ) ,
356352 ] ) ;
357353 void telemetryListener ?. sendUIInteraction ( "model-editor-switch-modes" ) ;
358354
@@ -410,11 +406,7 @@ export class ModelEditorView extends AbstractWebview<
410406 await this . generateModeledMethodsOnStartup ( ) ;
411407 } ) ,
412408 this . loadExistingModeledMethods ( ) ,
413- withProgress ( ( progress ) => this . loadAccessPathSuggestions ( progress ) , {
414- cancellable : false ,
415- location : ProgressLocation . Window ,
416- title : "Loading access path suggestions" ,
417- } ) ,
409+ this . loadAccessPathSuggestions ( ) ,
418410 ] ) ;
419411 }
420412
@@ -559,9 +551,7 @@ export class ModelEditorView extends AbstractWebview<
559551 }
560552 }
561553
562- protected async loadAccessPathSuggestions (
563- progress : ProgressCallback ,
564- ) : Promise < void > {
554+ protected async loadAccessPathSuggestions ( ) : Promise < void > {
565555 const mode = this . modelingStore . getMode ( this . databaseItem ) ;
566556
567557 const modelsAsDataLanguage = getModelsAsDataLanguage ( this . language ) ;
@@ -570,46 +560,55 @@ export class ModelEditorView extends AbstractWebview<
570560 return ;
571561 }
572562
573- try {
574- const suggestions = await runSuggestionsQuery ( mode , {
575- parseResults : ( results ) =>
576- accessPathSuggestions . parseResults (
577- results ,
578- modelsAsDataLanguage ,
579- this . app . logger ,
580- ) ,
581- queryConstraints : accessPathSuggestions . queryConstraints ( mode ) ,
582- cliServer : this . cliServer ,
583- queryRunner : this . queryRunner ,
584- queryStorageDir : this . queryStorageDir ,
585- databaseItem : this . databaseItem ,
586- progress,
587- token : this . cancellationTokenSource . token ,
588- logger : this . app . logger ,
589- } ) ;
563+ await withProgress (
564+ async ( progress ) => {
565+ try {
566+ const suggestions = await runSuggestionsQuery ( mode , {
567+ parseResults : ( results ) =>
568+ accessPathSuggestions . parseResults (
569+ results ,
570+ modelsAsDataLanguage ,
571+ this . app . logger ,
572+ ) ,
573+ queryConstraints : accessPathSuggestions . queryConstraints ( mode ) ,
574+ cliServer : this . cliServer ,
575+ queryRunner : this . queryRunner ,
576+ queryStorageDir : this . queryStorageDir ,
577+ databaseItem : this . databaseItem ,
578+ progress,
579+ token : this . cancellationTokenSource . token ,
580+ logger : this . app . logger ,
581+ } ) ;
590582
591- if ( ! suggestions ) {
592- return ;
593- }
583+ if ( ! suggestions ) {
584+ return ;
585+ }
594586
595- const options : AccessPathSuggestionOptions = {
596- input : parseAccessPathSuggestionRowsToOptions ( suggestions . input ) ,
597- output : parseAccessPathSuggestionRowsToOptions ( suggestions . output ) ,
598- } ;
587+ const options : AccessPathSuggestionOptions = {
588+ input : parseAccessPathSuggestionRowsToOptions ( suggestions . input ) ,
589+ output : parseAccessPathSuggestionRowsToOptions ( suggestions . output ) ,
590+ } ;
599591
600- await this . postMessage ( {
601- t : "setAccessPathSuggestions" ,
602- accessPathSuggestions : options ,
603- } ) ;
604- } catch ( e : unknown ) {
605- void showAndLogExceptionWithTelemetry (
606- this . app . logger ,
607- this . app . telemetry ,
608- redactableError (
609- asError ( e ) ,
610- ) `Failed to fetch access path suggestions: ${ getErrorMessage ( e ) } ` ,
611- ) ;
612- }
592+ await this . postMessage ( {
593+ t : "setAccessPathSuggestions" ,
594+ accessPathSuggestions : options ,
595+ } ) ;
596+ } catch ( e : unknown ) {
597+ void showAndLogExceptionWithTelemetry (
598+ this . app . logger ,
599+ this . app . telemetry ,
600+ redactableError (
601+ asError ( e ) ,
602+ ) `Failed to fetch access path suggestions: ${ getErrorMessage ( e ) } ` ,
603+ ) ;
604+ }
605+ } ,
606+ {
607+ cancellable : false ,
608+ location : ProgressLocation . Window ,
609+ title : "Loading access path suggestions" ,
610+ } ,
611+ ) ;
613612 }
614613
615614 protected async generateModeledMethods ( ) : Promise < void > {
0 commit comments