Make more parts of running a variant analysis cancellable

This commit is contained in:
Koen Vlaswinkel
2024-03-08 13:15:56 +01:00
parent 24b7adfb92
commit 27bb46ab4c
2 changed files with 11 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
import type { CodeQLCliServer } from "./cli";
import type { Uri } from "vscode";
import type { CancellationToken, Uri } from "vscode";
import { window } from "vscode";
import {
getLanguageDisplayName,
@@ -50,6 +50,7 @@ export async function findLanguage(
export async function askForLanguage(
cliServer: CodeQLCliServer,
throwOnEmpty = true,
token?: CancellationToken,
): Promise<QueryLanguage | undefined> {
const supportedLanguages = await cliServer.getSupportedLanguages();
@@ -62,10 +63,14 @@ export async function askForLanguage(
}))
.sort((a, b) => a.label.localeCompare(b.label));
const selectedItem = await window.showQuickPick(items, {
placeHolder: "Select target query language",
ignoreFocusOut: true,
});
const selectedItem = await window.showQuickPick(
items,
{
placeHolder: "Select target query language",
ignoreFocusOut: true,
},
token,
);
if (!selectedItem) {
// This only happens if the user cancels the quick pick.
if (throwOnEmpty) {

View File

@@ -229,7 +229,7 @@ export class VariantAnalysisManager
message: "Determining query language",
});
const language = await askForLanguage(this.cliServer);
const language = await askForLanguage(this.cliServer, true, token);
if (!language) {
return;
}