@@ -348,17 +348,7 @@ export class ModelEditorView extends AbstractWebview<
348348 withProgress ( ( progress ) => this . loadMethods ( progress ) , {
349349 cancellable : false ,
350350 } ) ,
351- // Only load access path suggestions if the feature is enabled
352- this . modelConfig . enableAccessPathSuggestions
353- ? withProgress (
354- ( progress ) => this . loadAccessPathSuggestions ( progress ) ,
355- {
356- cancellable : false ,
357- location : ProgressLocation . Window ,
358- title : "Loading access path suggestions" ,
359- } ,
360- )
361- : undefined ,
351+ this . loadAccessPathSuggestions ( ) ,
362352 ] ) ;
363353 void telemetryListener ?. sendUIInteraction ( "model-editor-switch-modes" ) ;
364354
@@ -416,14 +406,7 @@ export class ModelEditorView extends AbstractWebview<
416406 await this . generateModeledMethodsOnStartup ( ) ;
417407 } ) ,
418408 this . loadExistingModeledMethods ( ) ,
419- // Only load access path suggestions if the feature is enabled
420- this . modelConfig . enableAccessPathSuggestions
421- ? withProgress ( ( progress ) => this . loadAccessPathSuggestions ( progress ) , {
422- cancellable : false ,
423- location : ProgressLocation . Window ,
424- title : "Loading access path suggestions" ,
425- } )
426- : undefined ,
409+ this . loadAccessPathSuggestions ( ) ,
427410 ] ) ;
428411 }
429412
@@ -568,9 +551,7 @@ export class ModelEditorView extends AbstractWebview<
568551 }
569552 }
570553
571- protected async loadAccessPathSuggestions (
572- progress : ProgressCallback ,
573- ) : Promise < void > {
554+ protected async loadAccessPathSuggestions ( ) : Promise < void > {
574555 const mode = this . modelingStore . getMode ( this . databaseItem ) ;
575556
576557 const modelsAsDataLanguage = getModelsAsDataLanguage ( this . language ) ;
@@ -579,46 +560,55 @@ export class ModelEditorView extends AbstractWebview<
579560 return ;
580561 }
581562
582- try {
583- const suggestions = await runSuggestionsQuery ( mode , {
584- parseResults : ( results ) =>
585- accessPathSuggestions . parseResults (
586- results ,
587- modelsAsDataLanguage ,
588- this . app . logger ,
589- ) ,
590- queryConstraints : accessPathSuggestions . queryConstraints ( mode ) ,
591- cliServer : this . cliServer ,
592- queryRunner : this . queryRunner ,
593- queryStorageDir : this . queryStorageDir ,
594- databaseItem : this . databaseItem ,
595- progress,
596- token : this . cancellationTokenSource . token ,
597- logger : this . app . logger ,
598- } ) ;
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+ } ) ;
599582
600- if ( ! suggestions ) {
601- return ;
602- }
583+ if ( ! suggestions ) {
584+ return ;
585+ }
603586
604- const options : AccessPathSuggestionOptions = {
605- input : parseAccessPathSuggestionRowsToOptions ( suggestions . input ) ,
606- output : parseAccessPathSuggestionRowsToOptions ( suggestions . output ) ,
607- } ;
587+ const options : AccessPathSuggestionOptions = {
588+ input : parseAccessPathSuggestionRowsToOptions ( suggestions . input ) ,
589+ output : parseAccessPathSuggestionRowsToOptions ( suggestions . output ) ,
590+ } ;
608591
609- await this . postMessage ( {
610- t : "setAccessPathSuggestions" ,
611- accessPathSuggestions : options ,
612- } ) ;
613- } catch ( e : unknown ) {
614- void showAndLogExceptionWithTelemetry (
615- this . app . logger ,
616- this . app . telemetry ,
617- redactableError (
618- asError ( e ) ,
619- ) `Failed to fetch access path suggestions: ${ getErrorMessage ( e ) } ` ,
620- ) ;
621- }
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+ ) ;
622612 }
623613
624614 protected async generateModeledMethods ( ) : Promise < void > {
0 commit comments