@@ -348,11 +348,7 @@ export class ModelEditorView extends AbstractWebview<
348
348
withProgress ( ( progress ) => this . loadMethods ( progress ) , {
349
349
cancellable : false ,
350
350
} ) ,
351
- withProgress ( ( progress ) => this . loadAccessPathSuggestions ( progress ) , {
352
- cancellable : false ,
353
- location : ProgressLocation . Window ,
354
- title : "Loading access path suggestions" ,
355
- } ) ,
351
+ this . loadAccessPathSuggestions ( ) ,
356
352
] ) ;
357
353
void telemetryListener ?. sendUIInteraction ( "model-editor-switch-modes" ) ;
358
354
@@ -410,11 +406,7 @@ export class ModelEditorView extends AbstractWebview<
410
406
await this . generateModeledMethodsOnStartup ( ) ;
411
407
} ) ,
412
408
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 ( ) ,
418
410
] ) ;
419
411
}
420
412
@@ -559,9 +551,7 @@ export class ModelEditorView extends AbstractWebview<
559
551
}
560
552
}
561
553
562
- protected async loadAccessPathSuggestions (
563
- progress : ProgressCallback ,
564
- ) : Promise < void > {
554
+ protected async loadAccessPathSuggestions ( ) : Promise < void > {
565
555
const mode = this . modelingStore . getMode ( this . databaseItem ) ;
566
556
567
557
const modelsAsDataLanguage = getModelsAsDataLanguage ( this . language ) ;
@@ -570,46 +560,55 @@ export class ModelEditorView extends AbstractWebview<
570
560
return ;
571
561
}
572
562
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
+ } ) ;
590
582
591
- if ( ! suggestions ) {
592
- return ;
593
- }
583
+ if ( ! suggestions ) {
584
+ return ;
585
+ }
594
586
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
+ } ;
599
591
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
+ ) ;
613
612
}
614
613
615
614
protected async generateModeledMethods ( ) : Promise < void > {
0 commit comments