@@ -295,7 +295,6 @@ export class InterfaceManager extends DisposableObject {
295295 ) ;
296296
297297 this . _displayedQuery = results ;
298- this . _interpretation = interpretation ;
299298
300299 const panel = this . getPanel ( ) ;
301300 await this . waitForPanelLoaded ( ) ;
@@ -447,7 +446,7 @@ export class InterfaceManager extends DisposableObject {
447446 } ) ;
448447 }
449448
450- private async getTruncatedResults (
449+ private async _getInterpretedResults (
451450 metadata : QueryMetadata | undefined ,
452451 resultsPaths : ResultsPaths ,
453452 sourceInfo : cli . SourceInfo | undefined ,
@@ -460,30 +459,41 @@ export class InterfaceManager extends DisposableObject {
460459 resultsPaths ,
461460 sourceInfo
462461 ) ;
462+ const interpretation : Interpretation = {
463+ sarif,
464+ sourceLocationPrefix,
465+ numTruncatedResults : 0 ,
466+ sortState,
467+ } ;
468+ this . _interpretation = interpretation ;
469+ return interpretation ;
470+ }
471+
472+ private async getTruncatedResults (
473+ metadata : QueryMetadata | undefined ,
474+ resultsPaths : ResultsPaths ,
475+ sourceInfo : cli . SourceInfo | undefined ,
476+ sourceLocationPrefix : string ,
477+ sortState : InterpretedResultsSortState | undefined
478+ ) : Promise < Interpretation > {
463479 // For performance reasons, limit the number of results we try
464480 // to serialize and send to the webview. TODO: possibly also
465481 // limit number of paths per result, number of steps per path,
466482 // or throw an error if we are in aggregate trying to send
467483 // massively too much data, as it can make the extension
468484 // unresponsive.
469-
470- let numTruncatedResults = 0 ;
471- sarif . runs . forEach ( ( run ) => {
485+ const interpretation = await this . _getInterpretedResults ( metadata , resultsPaths , sourceInfo , sourceLocationPrefix , sortState ) ;
486+ interpretation . sarif . runs . forEach ( ( run ) => {
472487 if ( run . results !== undefined ) {
473488 sortInterpretedResults ( run . results , sortState ) ;
474489 if ( run . results . length > INTERPRETED_RESULTS_PER_RUN_LIMIT ) {
475- numTruncatedResults +=
490+ interpretation . numTruncatedResults +=
476491 run . results . length - INTERPRETED_RESULTS_PER_RUN_LIMIT ;
477492 run . results = run . results . slice ( 0 , INTERPRETED_RESULTS_PER_RUN_LIMIT ) ;
478493 }
479494 }
480495 } ) ;
481- return {
482- sarif,
483- sourceLocationPrefix,
484- numTruncatedResults,
485- sortState,
486- } ;
496+ return interpretation ;
487497 }
488498
489499 private async interpretResultsInfo (
0 commit comments