refactor(lsp): cleanup cache and module registry update (#23620)

This commit is contained in:
Nayeem Rahman 2024-05-03 20:52:58 +01:00 committed by GitHub
parent 02d0ff58d2
commit 1fce59281c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 138 additions and 153 deletions

View file

@ -116,6 +116,10 @@ impl MemoryFiles {
pub fn insert(&self, specifier: ModuleSpecifier, file: File) -> Option<File> {
self.0.lock().insert(specifier, file)
}
pub fn clear(&self) {
self.0.lock().clear();
}
}
/// Fetch a source file from the local file system.
@ -616,6 +620,10 @@ impl FileFetcher {
pub fn insert_memory_files(&self, file: File) -> Option<File> {
self.memory_files.insert(file.specifier.clone(), file)
}
pub fn clear_memory_files(&self) {
self.memory_files.clear();
}
}
#[derive(Debug, Eq, PartialEq)]