From 70cca74e5a03cea9cc6d1f87c481d8274c2e22cc Mon Sep 17 00:00:00 2001 From: Andreea Isac <48239328+andreeis@users.noreply.github.com> Date: Thu, 14 May 2020 16:07:32 -0700 Subject: [PATCH] Fix scope for state variable that guards the silent scan for kits (#1239) Fix scope for state variable that guards the silent scan for kits (from workspace to global) to avoid unnecessary scanning for every folder. --- src/kit.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/kit.ts b/src/kit.ts index dfea3cc01..bdd50f95e 100644 --- a/src/kit.ts +++ b/src/kit.ts @@ -975,13 +975,14 @@ export async function scanForKits(opt?: KitScanOptions) { // Rescan if the kits versions (extension context state var versus value defined for this release) don't match. export async function scanForKitsIfNeeded(context: vscode.ExtensionContext) : Promise { - const kitsVersionSaved = context.workspaceState.get('kitsVersionSaved'); + const kitsVersionSaved = context.globalState.get('kitsVersionSaved'); const kitsVersionCurrent = 1; // Scan also when there is no kits version saved in the state. - if (!kitsVersionSaved || kitsVersionSaved !== kitsVersionCurrent) { + if ((!kitsVersionSaved || kitsVersionSaved !== kitsVersionCurrent) && + process.env['CMT_TESTING'] !== '1') { await scanForKits(); - context.workspaceState.update('kitsVersionSaved', kitsVersionCurrent); + context.globalState.update('kitsVersionSaved', kitsVersionCurrent); } }