@@ -6,16 +6,16 @@ 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
- import * as helpers from './helpers' ;
13
12
import { showAndLogErrorMessage } from './helpers' ;
14
13
import { assertNever } from './helpers-pure' ;
15
- import { FromResultsViewMsg , Interpretation , IntoResultsViewMsg , ResultsInfo , SortedResultSetInfo , SortedResultsMap , INTERPRETED_RESULTS_PER_RUN_LIMIT , QueryMetadata } from './interface-types' ;
14
+ import { FromResultsViewMsg , Interpretation , IntoResultsViewMsg , SortedResultSetInfo , SortedResultsMap , INTERPRETED_RESULTS_PER_RUN_LIMIT , QueryMetadata } from './interface-types' ;
16
15
import { Logger } from './logging' ;
17
16
import * as messages from './messages' ;
18
- import { EvaluationInfo , interpretResults , QueryInfo , tmpDir } from './queries' ;
17
+ import { tmpDir , QueryInfo } from './run-queries' ;
18
+ import { CompletedQuery , interpretResults } from './query-results' ;
19
19
20
20
/**
21
21
* interface.ts
@@ -87,7 +87,7 @@ export function webviewUriToFileUri(webviewUri: string): Uri {
87
87
}
88
88
89
89
export class InterfaceManager extends DisposableObject {
90
- private _displayedEvaluationInfo ?: EvaluationInfo ;
90
+ private _displayedQuery ?: CompletedQuery ;
91
91
private _panel : vscode . WebviewPanel | undefined ;
92
92
private _panelLoaded = false ;
93
93
private _panelLoadedCallBacks : ( ( ) => void ) [ ] = [ ] ;
@@ -180,14 +180,14 @@ export class InterfaceManager extends DisposableObject {
180
180
this . _panelLoadedCallBacks = [ ] ;
181
181
break ;
182
182
case 'changeSort' : {
183
- if ( this . _displayedEvaluationInfo === undefined ) {
183
+ if ( this . _displayedQuery === undefined ) {
184
184
showAndLogErrorMessage ( "Failed to sort results since evaluation info was unknown." ) ;
185
185
break ;
186
186
}
187
187
// Notify the webview that it should expect new results.
188
188
await this . postMessage ( { t : 'resultsUpdating' } ) ;
189
- await this . _displayedEvaluationInfo . query . updateSortState ( this . cliServer , msg . resultSetName , msg . sortState ) ;
190
- await this . showResults ( this . _displayedEvaluationInfo , WebviewReveal . NotForced , true ) ;
189
+ await this . _displayedQuery . updateSortState ( this . cliServer , msg . resultSetName , msg . sortState ) ;
190
+ await this . showResults ( this . _displayedQuery , WebviewReveal . NotForced , true ) ;
191
191
break ;
192
192
}
193
193
default :
@@ -218,18 +218,18 @@ export class InterfaceManager extends DisposableObject {
218
218
* UI interaction requesting results, e.g. clicking on a query
219
219
* history entry.
220
220
*/
221
- public async showResults ( info : EvaluationInfo , forceReveal : WebviewReveal , shouldKeepOldResultsWhileRendering : boolean = false ) : Promise < void > {
222
- if ( info . result . resultType !== messages . QueryResultType . SUCCESS ) {
221
+ public async showResults ( results : CompletedQuery , forceReveal : WebviewReveal , shouldKeepOldResultsWhileRendering : boolean = false ) : Promise < void > {
222
+ if ( results . result . resultType !== messages . QueryResultType . SUCCESS ) {
223
223
return ;
224
224
}
225
225
226
- const interpretation = await this . interpretResultsInfo ( info . query , info . query . resultsInfo ) ;
226
+ const interpretation = await this . interpretResultsInfo ( results . query ) ;
227
227
228
228
const sortedResultsMap : SortedResultsMap = { } ;
229
- info . query . sortedResultsInfo . forEach ( ( v , k ) =>
229
+ results . sortedResultsInfo . forEach ( ( v , k ) =>
230
230
sortedResultsMap [ k ] = this . convertPathPropertiesToWebviewUris ( v ) ) ;
231
231
232
- this . _displayedEvaluationInfo = info ;
232
+ this . _displayedQuery = results ;
233
233
234
234
const panel = this . getPanel ( ) ;
235
235
await this . waitForPanelLoaded ( ) ;
@@ -242,7 +242,7 @@ export class InterfaceManager extends DisposableObject {
242
242
// more asynchronous message to not so abruptly interrupt
243
243
// user's workflow by immediately revealing the panel.
244
244
const showButton = 'View Results' ;
245
- const queryName = helpers . getQueryName ( info ) ;
245
+ const queryName = results . queryName ;
246
246
const resultPromise = vscode . window . showInformationMessage (
247
247
`Finished running query ${ ( queryName . length > 0 ) ? ` “${ queryName } ”` : '' } .` ,
248
248
showButton
@@ -259,11 +259,11 @@ 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
+ resultsPath : this . convertPathToWebviewUri ( results . query . resultsInfo . resultsPath ) ,
263
263
sortedResultsMap,
264
- database : info . database ,
264
+ database : results . database ,
265
265
shouldKeepOldResultsWhileRendering,
266
- metadata : info . query . metadata
266
+ metadata : results . query . metadata
267
267
} ) ;
268
268
}
269
269
@@ -288,7 +288,7 @@ private async getTruncatedResults(metadata : QueryMetadata | undefined ,resultsP
288
288
;
289
289
}
290
290
291
- private async interpretResultsInfo ( query : QueryInfo , resultsInfo : ResultsInfo ) : Promise < Interpretation | undefined > {
291
+ private async interpretResultsInfo ( query : QueryInfo ) : Promise < Interpretation | undefined > {
292
292
let interpretation : Interpretation | undefined = undefined ;
293
293
if ( query . hasInterpretedResults ( )
294
294
&& query . quickEvalPosition === undefined // never do results interpretation if quickEval
@@ -299,7 +299,7 @@ private async getTruncatedResults(metadata : QueryMetadata | undefined ,resultsP
299
299
const sourceInfo = sourceArchiveUri === undefined ?
300
300
undefined :
301
301
{ sourceArchive : sourceArchiveUri . fsPath , sourceLocationPrefix } ;
302
- interpretation = await this . getTruncatedResults ( query . metadata , resultsInfo . resultsPath , sourceInfo , sourceLocationPrefix ) ;
302
+ interpretation = await this . getTruncatedResults ( query . metadata , query . resultsInfo . resultsPath , sourceInfo , sourceLocationPrefix ) ;
303
303
}
304
304
catch ( e ) {
305
305
// If interpretation fails, accept the error and continue
0 commit comments