Stop pushing QL pack as top level folder to avoid confusing the user
In the original flow for creating skeleton packs, we were starting out by choosing a database (e.g. github/codeql) and having the extension create the QL pack for us. At that point, we were storing the QL pack together with the database in the extension storage because we weren't interested in committing it to the repo. This means we weren't able to see it in the file explorer so in order to make it visible, we decided to push it as a top-level folder in the workspace. Hindsight is 20/20. Let's change this original flow by just creating the folder in the workspace storage instead of the extension storage (which will make it visible in the file explorer) and stop pushing it as an extra top level folder in the workspace. NB: For this flow, we exit early in the `createSkeletonPacks` method if the folder already exists so we don't need to check this again.
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
showAndLogExceptionWithTelemetry,
|
||||
isFolderAlreadyInWorkspace,
|
||||
showBinaryChoiceDialog,
|
||||
getFirstStoragePath,
|
||||
} from "./helpers";
|
||||
import { ProgressCallback, withProgress } from "./progress";
|
||||
import {
|
||||
@@ -676,11 +677,13 @@ export class DatabaseManager extends DisposableObject {
|
||||
}
|
||||
|
||||
try {
|
||||
const workspaceStorage = getFirstStoragePath();
|
||||
|
||||
const qlPackGenerator = new QlPackGenerator(
|
||||
folderName,
|
||||
databaseItem.language as QueryLanguage,
|
||||
this.cli,
|
||||
this.ctx.storageUri?.fsPath,
|
||||
workspaceStorage,
|
||||
);
|
||||
await qlPackGenerator.generate();
|
||||
} catch (e: unknown) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { writeFile } from "fs-extra";
|
||||
import { mkdir, writeFile } from "fs-extra";
|
||||
import { dump } from "js-yaml";
|
||||
import { join } from "path";
|
||||
import { Uri, workspace } from "vscode";
|
||||
import { Uri } from "vscode";
|
||||
import { CodeQLCliServer } from "./cli";
|
||||
import { QueryLanguage } from "./common/query-language";
|
||||
|
||||
@@ -44,14 +44,7 @@ export class QlPackGenerator {
|
||||
}
|
||||
|
||||
private async createWorkspaceFolder() {
|
||||
await workspace.fs.createDirectory(this.folderUri);
|
||||
|
||||
const end = (workspace.workspaceFolders || []).length;
|
||||
|
||||
workspace.updateWorkspaceFolders(end, 0, {
|
||||
name: this.folderName,
|
||||
uri: this.folderUri,
|
||||
});
|
||||
await mkdir(this.folderUri.fsPath);
|
||||
}
|
||||
|
||||
private async createQlPackYaml() {
|
||||
|
||||
Reference in New Issue
Block a user