Skip to content

Commit e939750

Browse files
committed
Flush archive file systems when removed
This change will remove a file system archive from the cache when the associated folder is removed from the workspace. This avoids the following bug: 1. Import a database and add its source folder 2. Remove the database (source folder is removed as well automatically). 3. Change the source code and recreate the database 4. Reimport the database and source folder 5. BUG: You see the original source folder, not the new source folder
1 parent 21c33b7 commit e939750

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

extensions/ql-vscode/src/common/vscode/archive-filesystem-provider.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,17 @@ export class ArchiveFileSystemProvider implements FileSystemProvider {
242242

243243
root = new Directory("");
244244

245+
constructor() {
246+
// When a file system archive is removed from the workspace, we should
247+
// also remove it from our cache.
248+
workspace.onDidChangeWorkspaceFolders((event) => {
249+
for (const removed of event.removed) {
250+
const zipPath = removed.uri.fsPath;
251+
this.archives.delete(zipPath);
252+
}
253+
});
254+
}
255+
245256
// metadata
246257

247258
async stat(uri: Uri): Promise<FileStat> {

0 commit comments

Comments
 (0)