@@ -6,13 +6,13 @@ import { parseSarifLocation, parseSarifPlainTextMessage } from './sarif-utils';
66import { FivePartLocation , LocationValue , ResolvableLocationValue , WholeFileLocation , tryGetResolvableLocation , LocationStyle } from 'semmle-bqrs' ;
77import { DisposableObject } from 'semmle-vscode-utils' ;
88import * as vscode from 'vscode' ;
9- import { Diagnostic , DiagnosticRelatedInformation , DiagnosticSeverity , languages , Location , Position , Range , Uri , window as Window , workspace } from 'vscode' ;
9+ import { Diagnostic , DiagnosticRelatedInformation , DiagnosticSeverity , languages , Location , Range , Uri , window as Window , workspace } from 'vscode' ;
1010import { CodeQLCliServer } from './cli' ;
1111import { DatabaseItem , DatabaseManager } from './databases' ;
1212import * as helpers from './helpers' ;
1313import { showAndLogErrorMessage } from './helpers' ;
1414import { assertNever } from './helpers-pure' ;
15- import { FromResultsViewMsg , Interpretation , IntoResultsViewMsg , ResultsInfo , SortedResultSetInfo , SortedResultsMap , INTERPRETED_RESULTS_PER_RUN_LIMIT , QueryMetadata } from './interface-types' ;
15+ import { FromResultsViewMsg , Interpretation , IntoResultsViewMsg , ResultsPaths , SortedResultSetInfo , SortedResultsMap , INTERPRETED_RESULTS_PER_RUN_LIMIT , QueryMetadata } from './interface-types' ;
1616import { Logger } from './logging' ;
1717import * as messages from './messages' ;
1818import { EvaluationInfo , interpretResults , QueryInfo , tmpDir } from './queries' ;
@@ -166,7 +166,7 @@ export class InterfaceManager extends DisposableObject {
166166 if ( msg . visible ) {
167167 const databaseItem = this . databaseManager . findDatabaseItem ( Uri . parse ( msg . databaseUri ) ) ;
168168 if ( databaseItem !== undefined ) {
169- await this . showResultsAsDiagnostics ( msg . resultsPath , msg . metadata , databaseItem ) ;
169+ await this . showResultsAsDiagnostics ( msg . origResultsPaths , msg . metadata , databaseItem ) ;
170170 }
171171 } else {
172172 // TODO: Only clear diagnostics on the same database.
@@ -223,7 +223,7 @@ export class InterfaceManager extends DisposableObject {
223223 return ;
224224 }
225225
226- const interpretation = await this . interpretResultsInfo ( info . query , info . query . resultsInfo ) ;
226+ const interpretation = await this . interpretResultsInfo ( info . query , info . query . resultsPaths ) ;
227227
228228 const sortedResultsMap : SortedResultsMap = { } ;
229229 info . query . sortedResultsInfo . forEach ( ( v , k ) =>
@@ -259,16 +259,17 @@ export class InterfaceManager extends DisposableObject {
259259 await this . postMessage ( {
260260 t : 'setState' ,
261261 interpretation,
262- resultsPath : this . convertPathToWebviewUri ( info . query . resultsInfo . resultsPath ) ,
262+ origResultsPaths : info . query . resultsPaths ,
263+ resultsPath : this . convertPathToWebviewUri ( info . query . resultsPaths . resultsPath ) ,
263264 sortedResultsMap,
264265 database : info . database ,
265266 shouldKeepOldResultsWhileRendering,
266267 metadata : info . query . metadata
267268 } ) ;
268269 }
269270
270- private async getTruncatedResults ( metadata : QueryMetadata | undefined , resultsPathOnDisk : string , sourceInfo : cli . SourceInfo | undefined , sourceLocationPrefix : string ) : Promise < Interpretation > {
271- const sarif = await interpretResults ( this . cliServer , metadata , resultsPathOnDisk , sourceInfo ) ;
271+ private async getTruncatedResults ( metadata : QueryMetadata | undefined , resultsInfo : ResultsPaths , sourceInfo : cli . SourceInfo | undefined , sourceLocationPrefix : string ) : Promise < Interpretation > {
272+ const sarif = await interpretResults ( this . cliServer , metadata , resultsInfo , sourceInfo ) ;
272273 // For performance reasons, limit the number of results we try
273274 // to serialize and send to the webview. TODO: possibly also
274275 // limit number of paths per result, number of steps per path,
@@ -288,7 +289,7 @@ private async getTruncatedResults(metadata : QueryMetadata | undefined ,resultsP
288289 ;
289290}
290291
291- private async interpretResultsInfo ( query : QueryInfo , resultsInfo : ResultsInfo ) : Promise < Interpretation | undefined > {
292+ private async interpretResultsInfo ( query : QueryInfo , resultsInfo : ResultsPaths ) : Promise < Interpretation | undefined > {
292293 let interpretation : Interpretation | undefined = undefined ;
293294 if ( query . hasInterpretedResults ( )
294295 && query . quickEvalPosition === undefined // never do results interpretation if quickEval
@@ -299,7 +300,7 @@ private async getTruncatedResults(metadata : QueryMetadata | undefined ,resultsP
299300 const sourceInfo = sourceArchiveUri === undefined ?
300301 undefined :
301302 { sourceArchive : sourceArchiveUri . fsPath , sourceLocationPrefix } ;
302- interpretation = await this . getTruncatedResults ( query . metadata , resultsInfo . resultsPath , sourceInfo , sourceLocationPrefix ) ;
303+ interpretation = await this . getTruncatedResults ( query . metadata , resultsInfo , sourceInfo , sourceLocationPrefix ) ;
303304 }
304305 catch ( e ) {
305306 // If interpretation fails, accept the error and continue
@@ -311,15 +312,13 @@ private async getTruncatedResults(metadata : QueryMetadata | undefined ,resultsP
311312 }
312313
313314
314- private async showResultsAsDiagnostics ( webviewResultsUri : string , metadata : QueryMetadata | undefined , database : DatabaseItem ) {
315- // URIs from the webview have the vscode-resource scheme, so convert into a filesystem URI first.
316- const resultsPathOnDisk = webviewUriToFileUri ( webviewResultsUri ) . fsPath ;
315+ private async showResultsAsDiagnostics ( resultsInfo : ResultsPaths , metadata : QueryMetadata | undefined , database : DatabaseItem ) {
317316 const sourceLocationPrefix = await database . getSourceLocationPrefix ( this . cliServer ) ;
318317 const sourceArchiveUri = database . sourceArchive ;
319318 const sourceInfo = sourceArchiveUri === undefined ?
320319 undefined :
321320 { sourceArchive : sourceArchiveUri . fsPath , sourceLocationPrefix } ;
322- const interpretation = await this . getTruncatedResults ( metadata , resultsPathOnDisk , sourceInfo , sourceLocationPrefix ) ;
321+ const interpretation = await this . getTruncatedResults ( metadata , resultsInfo , sourceInfo , sourceLocationPrefix ) ;
323322
324323 try {
325324 await this . showProblemResultsAsDiagnostics ( interpretation , database ) ;
0 commit comments