Make "Create Query" command work with vscode-codeql-starter
We set up the "Create Query" command with the assumption that the first folder in the workspace is the parent folder. This is true for the `codespaces-codeql` repo where we expect to use this command. However, for the `vscode-codeql-starter` repo, the top level folders are QL packs: - codeql-custom-queries-cpp - codeql-custom-queries-ruby ... etc. In order to make the command work for people using the starter repo, we'll need to introduce a check for these QL packs when we decide the storage path. The end goal is to replace the starter workspace completely with the codespaces-codeql repo, so this code can be removed in the future when we retire the repo. Until then, the command will need this to be able to work in both starter workspaces.
This commit is contained in:
@@ -91,7 +91,15 @@ export class SkeletonQueryWizard {
|
||||
|
||||
const firstFolder = workspaceFolders[0];
|
||||
|
||||
return firstFolder.uri.path;
|
||||
// For the vscode-codeql-starter repo, the first folder will be a ql pack
|
||||
// so we need to get the parent folder
|
||||
if (firstFolder.uri.path.includes("codeql-custom-queries")) {
|
||||
// slice off the last part of the path and return the parent folder
|
||||
return firstFolder.uri.path.split("/").slice(0, -1).join("/");
|
||||
} else {
|
||||
// if the first folder is not a ql pack, then we are in a normal workspace
|
||||
return firstFolder.uri.path;
|
||||
}
|
||||
}
|
||||
|
||||
private async chooseLanguage() {
|
||||
|
||||
Reference in New Issue
Block a user