Set up new config setting for auto generating QL packs

In the next commit we will write to this setting when the user chooses
to disable the QL pack generation and prefers to never be asked again
about it.
This commit is contained in:
Elena Tanasoiu
2023-04-19 16:28:35 +00:00
parent 3eef0e9797
commit ae320d0fef
2 changed files with 19 additions and 0 deletions

View File

@@ -346,6 +346,12 @@
"default": "",
"patternErrorMessage": "Please enter a valid folder",
"markdownDescription": "The name of the folder where we want to create queries and query packs via the \"CodeQL: Create Query\" command. The folder should exist."
},
"codeQL.autogenerateQlPacks": {
"type": "string",
"default": "",
"patternErrorMessage": "Please choose between 'Yes', 'No' and 'No, and never ask me again'",
"markdownDescription": "The choice of whether to autogenerate QL packs for the current workspace. The choice is 'Yes', 'No' or 'No, and never ask me again'."
}
}
},

View File

@@ -635,3 +635,16 @@ export function getSkeletonWizardFolder(): string | undefined {
export async function setSkeletonWizardFolder(folder: string | undefined) {
await SKELETON_WIZARD_FOLDER.updateValue(folder, ConfigurationTarget.Global);
}
/**
* Option to turn on/off ability to autogenerate QL packs. Values are "Yes" / "No" / "Never ask again"
**/
const AUTOGENERATE_QL_PACKS = new Setting("autogenerateQlPacks", ROOT_SETTING);
export function getAutogenerateQlPacks(): string | undefined {
return AUTOGENERATE_QL_PACKS.getValue<string>() || undefined;
}
export async function setAutogenerateQlPacks(choice: string | undefined) {
await AUTOGENERATE_QL_PACKS.updateValue(choice, ConfigurationTarget.Global);
}