Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
lsp store: Refactor to use shared method to find buffer snapshot (#17929)
Thorsten Ballc34fc5c6e504
diff --git a/crates/project/src/lsp_store.rs b/crates/project/src/lsp_store.rsindex ee02492dd8c..fb3d52eb9eb 100644--- a/crates/project/src/lsp_store.rs+++ b/crates/project/src/lsp_store.rs@@ -6383,21 +6383,16 @@ impl LspStore {let buffer_id = buffer_to_edit.read(cx).remote_id();let version = if let Some(buffer_version) = op.text_document.version{- this.buffer_snapshots- .get(&buffer_id)- .and_then(|server_to_snapshots| {- let all_snapshots = server_to_snapshots- .get(&language_server.server_id())?;- all_snapshots- .binary_search_by_key(&buffer_version, |snapshot| {- snapshot.version- })- .ok()- .and_then(|index| all_snapshots.get(index))- })- .map(|lsp_snapshot| lsp_snapshot.snapshot.version())+ this.buffer_snapshot_for_lsp_version(+ &buffer_to_edit,+ language_server.server_id(),+ Some(buffer_version),+ cx,+ )+ .ok()+ .map(|snapshot| snapshot.version)} else {- Some(buffer_to_edit.read(cx).saved_version())+ Some(buffer_to_edit.read(cx).saved_version().clone())};let most_recent_edit = version.and_then(|version| {