@@ -6,13 +6,13 @@ import { parseSarifLocation, parseSarifPlainTextMessage } from './sarif-utils';
6
6
import { FivePartLocation , LocationValue , ResolvableLocationValue , WholeFileLocation , tryGetResolvableLocation , LocationStyle } from 'semmle-bqrs' ;
7
7
import { DisposableObject } from 'semmle-vscode-utils' ;
8
8
import * 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' ;
10
10
import { CodeQLCliServer } from './cli' ;
11
11
import { DatabaseItem , DatabaseManager } from './databases' ;
12
12
import * as helpers from './helpers' ;
13
13
import { showAndLogErrorMessage } from './helpers' ;
14
14
import { 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' ;
16
16
import { Logger } from './logging' ;
17
17
import * as messages from './messages' ;
18
18
import { EvaluationInfo , interpretResults , QueryInfo , tmpDir } from './queries' ;
@@ -166,7 +166,7 @@ export class InterfaceManager extends DisposableObject {
166
166
if ( msg . visible ) {
167
167
const databaseItem = this . databaseManager . findDatabaseItem ( Uri . parse ( msg . databaseUri ) ) ;
168
168
if ( databaseItem !== undefined ) {
169
- await this . showResultsAsDiagnostics ( msg . resultsPath , msg . metadata , databaseItem ) ;
169
+ await this . showResultsAsDiagnostics ( msg . origResultsPaths , msg . metadata , databaseItem ) ;
170
170
}
171
171
} else {
172
172
// TODO: Only clear diagnostics on the same database.
@@ -223,7 +223,7 @@ export class InterfaceManager extends DisposableObject {
223
223
return ;
224
224
}
225
225
226
- const interpretation = await this . interpretResultsInfo ( info . query , info . query . resultsInfo ) ;
226
+ const interpretation = await this . interpretResultsInfo ( info . query , info . query . resultsPaths ) ;
227
227
228
228
const sortedResultsMap : SortedResultsMap = { } ;
229
229
info . query . sortedResultsInfo . forEach ( ( v , k ) =>
@@ -259,16 +259,17 @@ export class InterfaceManager extends DisposableObject {
259
259
await this . postMessage ( {
260
260
t : 'setState' ,
261
261
interpretation,
262
- resultsPath : this . convertPathToWebviewUri ( info . query . resultsInfo . resultsPath ) ,
262
+ origResultsPaths : info . query . resultsPaths ,
263
+ resultsPath : this . convertPathToWebviewUri ( info . query . resultsPaths . resultsPath ) ,
263
264
sortedResultsMap,
264
265
database : info . database ,
265
266
shouldKeepOldResultsWhileRendering,
266
267
metadata : info . query . metadata
267
268
} ) ;
268
269
}
269
270
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 ) ;
272
273
// For performance reasons, limit the number of results we try
273
274
// to serialize and send to the webview. TODO: possibly also
274
275
// limit number of paths per result, number of steps per path,
@@ -288,7 +289,7 @@ private async getTruncatedResults(metadata : QueryMetadata | undefined ,resultsP
288
289
;
289
290
}
290
291
291
- private async interpretResultsInfo ( query : QueryInfo , resultsInfo : ResultsInfo ) : Promise < Interpretation | undefined > {
292
+ private async interpretResultsInfo ( query : QueryInfo , resultsInfo : ResultsPaths ) : Promise < Interpretation | undefined > {
292
293
let interpretation : Interpretation | undefined = undefined ;
293
294
if ( query . hasInterpretedResults ( )
294
295
&& query . quickEvalPosition === undefined // never do results interpretation if quickEval
@@ -299,7 +300,7 @@ private async getTruncatedResults(metadata : QueryMetadata | undefined ,resultsP
299
300
const sourceInfo = sourceArchiveUri === undefined ?
300
301
undefined :
301
302
{ 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 ) ;
303
304
}
304
305
catch ( e ) {
305
306
// If interpretation fails, accept the error and continue
@@ -311,15 +312,13 @@ private async getTruncatedResults(metadata : QueryMetadata | undefined ,resultsP
311
312
}
312
313
313
314
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 ) {
317
316
const sourceLocationPrefix = await database . getSourceLocationPrefix ( this . cliServer ) ;
318
317
const sourceArchiveUri = database . sourceArchive ;
319
318
const sourceInfo = sourceArchiveUri === undefined ?
320
319
undefined :
321
320
{ sourceArchive : sourceArchiveUri . fsPath , sourceLocationPrefix } ;
322
- const interpretation = await this . getTruncatedResults ( metadata , resultsPathOnDisk , sourceInfo , sourceLocationPrefix ) ;
321
+ const interpretation = await this . getTruncatedResults ( metadata , resultsInfo , sourceInfo , sourceLocationPrefix ) ;
323
322
324
323
try {
325
324
await this . showProblemResultsAsDiagnostics ( interpretation , database ) ;
0 commit comments