fix(lsp): reduce deadlocks with in memory documents (#9259)

This commit is contained in:
Kitson Kelly 2021-01-26 10:47:12 +11:00 committed by GitHub
parent 1f8b83ba1a
commit 2b4e0be43c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 59 deletions

View file

@ -58,7 +58,7 @@ pub struct LanguageServer {
#[derive(Debug, Clone, Default)]
pub struct StateSnapshot {
pub assets: Arc<Mutex<HashMap<ModuleSpecifier, Option<AssetDocument>>>>,
pub documents: Arc<Mutex<DocumentCache>>,
pub documents: DocumentCache,
pub sources: Arc<Mutex<Sources>>,
}
@ -289,7 +289,7 @@ impl LanguageServer {
pub fn snapshot(&self) -> StateSnapshot {
StateSnapshot {
assets: self.assets.clone(),
documents: self.documents.clone(),
documents: self.documents.lock().unwrap().clone(),
sources: self.sources.clone(),
}
}