Skip to content

Commit

Permalink
fix deadlock caused by 1f3fd35
Browse files Browse the repository at this point in the history
  • Loading branch information
SpontanCombust committed Apr 17, 2024
1 parent 98724ff commit 669e4e6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crates/lsp/src/providers/document_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pub async fn did_open(backend: &Backend, params: lsp::DidOpenTextDocumentParams)

pub async fn did_change(backend: &Backend, params: lsp::DidChangeTextDocumentParams) {
let doc_path = AbsPath::try_from(params.text_document.uri.clone()).unwrap();
let mut should_notify = false;
if let Some(mut entry) = backend.scripts.get_mut(&doc_path) {
let script_state = entry.value_mut();

Expand All @@ -47,9 +48,13 @@ pub async fn did_change(backend: &Backend, params: lsp::DidChangeTextDocumentPar

script_state.modified_timestamp = FileTime::now();

should_notify = true;
}

if should_notify {
backend.on_scripts_modified([doc_path.clone()], true).await;
backend.reporter.commit_diagnostics(&doc_path).await;
}
}
}

// Not all circumstances can be easily handled or even detected.
Expand Down

0 comments on commit 669e4e6

Please sign in to comment.