Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

lsp: Check for existing snapshots before sending off a didOpen notification (#25409)

Piotr Osiewicz918cba4cce84
diff --git a/crates/project/src/lsp_store.rs b/crates/project/src/lsp_store.rs
index 632b96c8b78..0c89f5c0f1a 100644
--- a/crates/project/src/lsp_store.rs
+++ b/crates/project/src/lsp_store.rs
@@ -1921,17 +1921,20 @@ impl LocalLspStore {
version: 0,
snapshot: initial_snapshot.clone(),
};
- self.buffer_snapshots
+ let previous_snapshots = self
+ .buffer_snapshots
.entry(buffer_id)
.or_default()
.insert(server.server_id(), vec![snapshot]);
- server.register_buffer(
- uri.clone(),
- adapter.language_id(&language.name()),
- 0,
- initial_snapshot.text(),
- );
+ if previous_snapshots.is_none() {
+ server.register_buffer(
+ uri.clone(),
+ adapter.language_id(&language.name()),
+ 0,
+ initial_snapshot.text(),
+ );
+ }
}
}
}