Skip to content

Commit cdb6e8a

Browse files
committed
Move all progress reporting into extension packs file
1 parent 035456c commit cdb6e8a

File tree

2 files changed

+26
-16
lines changed

2 files changed

+26
-16
lines changed

extensions/ql-vscode/src/data-extensions-editor/data-extensions-editor-module.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { join } from "path";
99
import { App } from "../common/app";
1010
import { showAndLogErrorMessage } from "../helpers";
1111
import { withProgress } from "../progress";
12-
import { pickExtensionPack, pickModelFile } from "./extension-packs";
12+
import { pickExtensionPackModelFile } from "./extension-packs";
1313

1414
export class DataExtensionsEditorModule {
1515
private readonly queryStorageDir: string;
@@ -67,19 +67,10 @@ export class DataExtensionsEditorModule {
6767
return;
6868
}
6969

70-
const extensionPackPath = await pickExtensionPack(
70+
const modelFile = await pickExtensionPackModelFile(
7171
this.cliServer,
7272
progress,
7373
);
74-
if (!extensionPackPath) {
75-
return;
76-
}
77-
78-
const modelFile = await pickModelFile(
79-
this.cliServer,
80-
progress,
81-
extensionPackPath,
82-
);
8374
if (!modelFile) {
8475
return;
8576
}

extensions/ql-vscode/src/data-extensions-editor/extension-packs.ts

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,33 @@ import { CodeQLCliServer } from "../cli";
44
import { getOnDiskWorkspaceFolders, showAndLogErrorMessage } from "../helpers";
55
import { ProgressCallback } from "../progress";
66

7-
export async function pickExtensionPack(
7+
const maxStep = 3;
8+
9+
export async function pickExtensionPackModelFile(
10+
cliServer: CodeQLCliServer,
11+
progress: ProgressCallback,
12+
): Promise<string | undefined> {
13+
const extensionPackPath = await pickExtensionPack(cliServer, progress);
14+
if (!extensionPackPath) {
15+
return;
16+
}
17+
18+
const modelFile = await pickModelFile(cliServer, progress, extensionPackPath);
19+
if (!modelFile) {
20+
return;
21+
}
22+
23+
return modelFile;
24+
}
25+
26+
async function pickExtensionPack(
827
cliServer: CodeQLCliServer,
928
progress: ProgressCallback,
1029
): Promise<string | undefined> {
1130
progress({
1231
message: "Resolving extension packs...",
1332
step: 1,
14-
maxStep: 3,
33+
maxStep,
1534
});
1635

1736
// Get all existing extension packs in the workspace
@@ -25,7 +44,7 @@ export async function pickExtensionPack(
2544
progress({
2645
message: "Choosing extension pack...",
2746
step: 2,
28-
maxStep: 3,
47+
maxStep,
2948
});
3049

3150
const extensionPackOption = await window.showQuickPick(options, {
@@ -53,7 +72,7 @@ export async function pickExtensionPack(
5372
return extensionPackPaths[0];
5473
}
5574

56-
export async function pickModelFile(
75+
async function pickModelFile(
5776
cliServer: CodeQLCliServer,
5877
progress: ProgressCallback,
5978
extensionPackPath: string,
@@ -84,7 +103,7 @@ export async function pickModelFile(
84103
progress({
85104
message: "Choosing model file...",
86105
step: 3,
87-
maxStep: 3,
106+
maxStep,
88107
});
89108

90109
const fileOption = await window.showQuickPick(fileOptions, {

0 commit comments

Comments
 (0)