diff --git a/extensions/ql-vscode/src/query-history.ts b/extensions/ql-vscode/src/query-history.ts index 73116e6e8..c74ee2271 100644 --- a/extensions/ql-vscode/src/query-history.ts +++ b/extensions/ql-vscode/src/query-history.ts @@ -812,13 +812,16 @@ export class QueryHistoryManager extends DisposableObject { } private warnNoEvalLog() { - void showAndLogWarningMessage('No evaluator log is available for this run. Perhaps it failed before evaluation, or you are running with a version of CodeQL before ' + CliVersionConstraint.CLI_VERSION_WITH_PER_QUERY_EVAL_LOG + '?'); + void showAndLogWarningMessage(`No evaluator log is available for this run. Perhaps it failed before evaluation, or you are running with a version of CodeQL before ' + ${CliVersionConstraint.CLI_VERSION_WITH_PER_QUERY_EVAL_LOG}?`); } private warnNoEvalLogSummary() { - void showAndLogWarningMessage(`No evaluator log summary is available for this run. Perhaps it failed before evaluation, or you are running with a version of CodeQL before ${CliVersionConstraint.CLI_VERSION_WITH_PER_QUERY_EVAL_LOG}?`); + void showAndLogWarningMessage(`Evaluator log summary and evaluator log are not available for this run. Perhaps they failed before evaluation, or you are running with a version of CodeQL before ${CliVersionConstraint.CLI_VERSION_WITH_PER_QUERY_EVAL_LOG}?`); } + private warnInProgressEvalLogSummary() { + void showAndLogWarningMessage('The evaluator log summary is still being generated. Please try again later. The summary generation process is tracked in the "CodeQL Extension Log" view.'); + } async handleShowEvalLog( singleItem: QueryHistoryInfo, @@ -851,8 +854,15 @@ export class QueryHistoryManager extends DisposableObject { if (finalSingleItem.evalLogSummaryLocation) { await this.tryOpenExternalFile(finalSingleItem.evalLogSummaryLocation); - } else { - this.warnNoEvalLogSummary(); + } + // Summary log file doesn't exist. + else { + if (finalSingleItem.evalLogLocation && fs.pathExists(finalSingleItem.evalLogLocation)) { + // If raw log does exist, then the summary log is still being generated. + this.warnInProgressEvalLogSummary(); + } else { + this.warnNoEvalLogSummary(); + } } } diff --git a/extensions/ql-vscode/src/run-queries.ts b/extensions/ql-vscode/src/run-queries.ts index 67f974755..f5e051306 100644 --- a/extensions/ql-vscode/src/run-queries.ts +++ b/extensions/ql-vscode/src/run-queries.ts @@ -199,15 +199,21 @@ export class QueryEvaluationInfo { }); if (await this.hasEvalLog()) { queryInfo.evalLogLocation = this.evalLogPath; - await qs.cliServer.generateLogSummary(this.evalLogPath, this.evalLogSummaryPath, this.evalLogEndSummaryPath); - queryInfo.evalLogSummaryLocation = this.evalLogSummaryPath; - fs.readFile(this.evalLogEndSummaryPath, (err, buffer) => { - if (err) { - throw new Error(`Could not read structured evaluator log end of summary file at ${this.evalLogEndSummaryPath}.`); - } - void qs.logger.log(' --- Evaluator Log Summary --- '); - void qs.logger.log(buffer.toString()); - }); + void qs.cliServer.generateLogSummary(this.evalLogPath, this.evalLogSummaryPath, this.evalLogEndSummaryPath) + .then(() => { + queryInfo.evalLogSummaryLocation = this.evalLogSummaryPath; + fs.readFile(this.evalLogEndSummaryPath, (err, buffer) => { + if (err) { + throw new Error(`Could not read structured evaluator log end of summary file at ${this.evalLogEndSummaryPath}.`); + } + void qs.logger.log(' --- Evaluator Log Summary --- '); + void qs.logger.log(buffer.toString()); + }); + }) + + .catch(err => { + void showAndLogWarningMessage(`Failed to generate structured evaluator log summary. Reason: ${err.message}`); + }); } else { void showAndLogWarningMessage(`Failed to write structured evaluator log to ${this.evalLogPath}.`); }