Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Use originating language server to resolve additional completion edits
Julia40ce099780f5
diff --git a/crates/language/src/buffer.rs b/crates/language/src/buffer.rsindex 0b10432a9f4..ec5f9541f58 100644--- a/crates/language/src/buffer.rs+++ b/crates/language/src/buffer.rs@@ -149,6 +149,7 @@ pub struct Completion {pub old_range: Range<Anchor>,pub new_text: String,pub label: CodeLabel,+ pub server_id: LanguageServerId,pub lsp_completion: lsp::CompletionItem,}diff --git a/crates/language/src/proto.rs b/crates/language/src/proto.rsindex 0de3f704c7f..c463c7a01c4 100644--- a/crates/language/src/proto.rs+++ b/crates/language/src/proto.rs@@ -433,6 +433,7 @@ pub fn serialize_completion(completion: &Completion) -> proto::Completion {old_start: Some(serialize_anchor(&completion.old_range.start)),old_end: Some(serialize_anchor(&completion.old_range.end)),new_text: completion.new_text.clone(),+ server_id: completion.server_id.0 as u64,lsp_completion: serde_json::to_vec(&completion.lsp_completion).unwrap(),}}@@ -465,6 +466,7 @@ pub async fn deserialize_completion(lsp_completion.filter_text.as_deref(),)}),+ server_id: LanguageServerId(completion.server_id as usize),lsp_completion,})}diff --git a/crates/project/src/lsp_command.rs b/crates/project/src/lsp_command.rsindex a8692257d80..ad5b63ae2a6 100644--- a/crates/project/src/lsp_command.rs+++ b/crates/project/src/lsp_command.rs@@ -1338,7 +1338,7 @@ impl LspCommand for GetCompletions {completions: Option<lsp::CompletionResponse>,_: ModelHandle<Project>,buffer: ModelHandle<Buffer>,- _: LanguageServerId,+ server_id: LanguageServerId,cx: AsyncAppContext,) -> Result<Vec<Completion>> {let completions = if let Some(completions) = completions {@@ -1425,6 +1425,7 @@ impl LspCommand for GetCompletions {lsp_completion.filter_text.as_deref(),)}),+ server_id,lsp_completion,}})diff --git a/crates/project/src/project.rs b/crates/project/src/project.rsindex f85460770d9..7986d6faecc 100644--- a/crates/project/src/project.rs+++ b/crates/project/src/project.rs@@ -4470,7 +4470,8 @@ impl Project {let buffer_id = buffer.remote_id();if self.is_local() {- let lang_server = match self.primary_language_server_for_buffer(buffer, cx) {+ let server_id = completion.server_id;+ let lang_server = match self.language_server_for_buffer(buffer, server_id, cx) {Some((_, server)) => server.clone(),_ => return Task::ready(Ok(Default::default())),};diff --git a/crates/rpc/proto/zed.proto b/crates/rpc/proto/zed.protoindex a0b98372b10..2bc31dccc32 100644--- a/crates/rpc/proto/zed.proto+++ b/crates/rpc/proto/zed.proto@@ -630,7 +630,8 @@ message Completion {Anchor old_start = 1;Anchor old_end = 2;string new_text = 3;- bytes lsp_completion = 4;+ uint64 server_id = 4;+ bytes lsp_completion = 5;}message GetCodeActions {diff --git a/crates/rpc/src/rpc.rs b/crates/rpc/src/rpc.rsindex 6b430d90e46..3cb8b6bffa2 100644--- a/crates/rpc/src/rpc.rs+++ b/crates/rpc/src/rpc.rs@@ -6,4 +6,4 @@ pub use conn::Connection;pub use peer::*;mod macros;-pub const PROTOCOL_VERSION: u32 = 59;+pub const PROTOCOL_VERSION: u32 = 60;