mirror of
https://github.com/Automattic/harper.git
synced 2025-12-05 19:26:55 -06:00
fix(ls): potential deadlock causing #486
This commit is contained in:
@@ -289,11 +289,16 @@ impl Backend {
|
||||
url: &Url,
|
||||
range: Range,
|
||||
) -> JsonResult<Vec<CodeActionOrCommand>> {
|
||||
let (config, mut doc_states) = tokio::join!(self.config.read(), self.doc_state.lock());
|
||||
let (config_guard, mut doc_states) =
|
||||
tokio::join!(self.config.read(), self.doc_state.lock());
|
||||
let Some(doc_state) = doc_states.get_mut(url) else {
|
||||
return Ok(Vec::new());
|
||||
};
|
||||
|
||||
// Allow writes as soon as possible to avoid deadlocks
|
||||
let config = config_guard.clone();
|
||||
drop(config_guard);
|
||||
|
||||
let mut lints = doc_state.linter.lint(&doc_state.document);
|
||||
lints.sort_by_key(|l| l.priority);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user