Clear pack cache on create and delete

We were only clearing the pack cache when a pack file was modified. When
using a script to create a new pack, the pack file is created at once
without a change event firing. This will change the behavior to also
clear the pack cache when a pack file is created or deleted.
This commit is contained in:
Koen Vlaswinkel
2023-04-19 14:36:39 +02:00
parent 7f3f3380ad
commit 686a9e4095

View File

@@ -707,9 +707,14 @@ async function activateWithInstalledDistribution(
for (const glob of PACK_GLOBS) {
const fsWatcher = workspace.createFileSystemWatcher(glob);
ctx.subscriptions.push(fsWatcher);
fsWatcher.onDidChange(async (_uri) => {
const clearPackCache = async (_uri: Uri) => {
await qs.clearPackCache();
});
};
fsWatcher.onDidCreate(clearPackCache);
fsWatcher.onDidChange(clearPackCache);
fsWatcher.onDidDelete(clearPackCache);
}
void extLogger.log("Initializing database manager.");