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
This commit is contained in:
Andrew Eisenberg
2024-03-25 16:21:48 -07:00
parent 21c33b762c
commit e939750822

View File

@@ -242,6 +242,17 @@ export class ArchiveFileSystemProvider implements FileSystemProvider {
root = new Directory("");
constructor() {
// When a file system archive is removed from the workspace, we should
// also remove it from our cache.
workspace.onDidChangeWorkspaceFolders((event) => {
for (const removed of event.removed) {
const zipPath = removed.uri.fsPath;
this.archives.delete(zipPath);
}
});
}
// metadata
async stat(uri: Uri): Promise<FileStat> {