Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions extensions/ql-vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [UNRELEASED]

- Fix a bug where database upgrades could not be resolved if some of the target pack's dependencies are outside of the workspace. [#1138](https://github.com/github/vscode-codeql/pull/1138)
- Open the query server logs for query errors (instead of the extension log). This will make it easier to track down query errors. [#1158](https://github.com/github/vscode-codeql/pull/1158)
- Fix a bug where queries took a long time to run if there are no folders in the workspace. [#1157](https://github.com/github/vscode-codeql/pull/1157)

## 1.5.11 - 10 February 2022
Expand Down
8 changes: 5 additions & 3 deletions extensions/ql-vscode/src/commandRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ export function commandRunner(
export function commandRunnerWithProgress<R>(
commandId: string,
task: ProgressTask<R>,
progressOptions: Partial<ProgressOptions>
progressOptions: Partial<ProgressOptions>,
outputLogger = logger
): Disposable {
return commands.registerCommand(commandId, async (...args: any[]) => {
const startTime = Date.now();
Expand All @@ -177,16 +178,17 @@ export function commandRunnerWithProgress<R>(
if (e instanceof UserCancellationException) {
// User has cancelled this action manually
if (e.silent) {
void logger.log(errorMessage);
void outputLogger.log(errorMessage);
} else {
void showAndLogWarningMessage(errorMessage);
void showAndLogWarningMessage(errorMessage, { outputLogger });
}
} else {
// Include the full stack in the error log only.
const fullMessage = e.stack
? `${errorMessage}\n${e.stack}`
: errorMessage;
void showAndLogErrorMessage(errorMessage, {
outputLogger,
fullMessage
});
}
Expand Down
28 changes: 23 additions & 5 deletions extensions/ql-vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@ async function activateWithInstalledDistribution(
// Note we must update the query history view after showing results as the
// display and sorting might depend on the number of results
} catch (e) {
e.message = `Error running query: ${e.message}`;
item.failureReason = e.message;
throw e;
} finally {
Expand Down Expand Up @@ -639,7 +640,10 @@ async function activateWithInstalledDistribution(
{
title: 'Running query',
cancellable: true
}
},

// Open the query server logger on error since that's usually where the interesting errors appear.
queryServerLogger
)
);
interface DatabaseQuickPickItem extends QuickPickItem {
Expand Down Expand Up @@ -771,7 +775,11 @@ async function activateWithInstalledDistribution(
{
title: 'Running queries',
cancellable: true
})
},

// Open the query server logger on error since that's usually where the interesting errors appear.
queryServerLogger
)
);
ctx.subscriptions.push(
commandRunnerWithProgress(
Expand All @@ -784,7 +792,10 @@ async function activateWithInstalledDistribution(
{
title: 'Running query',
cancellable: true
})
},
// Open the query server logger on error since that's usually where the interesting errors appear.
queryServerLogger
)
);

ctx.subscriptions.push(
Expand All @@ -799,7 +810,11 @@ async function activateWithInstalledDistribution(
{
title: 'Running query',
cancellable: true
})
},

// Open the query server logger on error since that's usually where the interesting errors appear.
queryServerLogger
)
);

ctx.subscriptions.push(
Expand All @@ -810,7 +825,10 @@ async function activateWithInstalledDistribution(
displayQuickQuery(ctx, cliServer, databaseUI, progress, token),
{
title: 'Run Quick Query'
}
},

// Open the query server logger on error since that's usually where the interesting errors appear.
queryServerLogger
)
);

Expand Down