Skip to content

Commit

Permalink
Fix scope for state variable that guards the silent scan for kits (#1239
Browse files Browse the repository at this point in the history
)

Fix scope for state variable that guards the silent scan for kits (from workspace to global) to avoid unnecessary scanning for every folder.
  • Loading branch information
andreeis authored May 14, 2020
1 parent fe1f910 commit 70cca74
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/kit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
const kitsVersionSaved = context.workspaceState.get<number>('kitsVersionSaved');
const kitsVersionSaved = context.globalState.get<number>('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);
}
}

Expand Down

0 comments on commit 70cca74

Please sign in to comment.