Fill capabilities on project (re)join (#35892)

Follow-up of https://github.com/zed-industries/zed/pull/35682

Release Notes:

- N/A

Co-authored-by: Smit Barmase <smit@zed.dev>
This commit is contained in:
Kirill Bulatov 2025-08-08 23:12:41 +03:00
parent a1ad6af1b1
commit e24aa382a4
2 changed files with 17 additions and 4 deletions

View file

@ -7722,12 +7722,19 @@ impl LspStore {
pub(crate) fn set_language_server_statuses_from_proto(
&mut self,
language_servers: Vec<proto::LanguageServer>,
server_capabilities: Vec<String>,
) {
self.language_server_statuses = language_servers
.into_iter()
.map(|server| {
.zip(server_capabilities)
.map(|(server, server_capabilities)| {
let server_id = LanguageServerId(server.id as usize);
if let Ok(server_capabilities) = serde_json::from_str(&server_capabilities) {
self.lsp_server_capabilities
.insert(server_id, server_capabilities);
}
(
LanguageServerId(server.id as usize),
server_id,
LanguageServerStatus {
name: LanguageServerName::from_proto(server.name),
pending_work: Default::default(),

View file

@ -1488,7 +1488,10 @@ impl Project {
fs.clone(),
cx,
);
lsp_store.set_language_server_statuses_from_proto(response.payload.language_servers);
lsp_store.set_language_server_statuses_from_proto(
response.payload.language_servers,
response.payload.language_server_capabilities,
);
lsp_store
})?;
@ -2319,7 +2322,10 @@ impl Project {
self.set_worktrees_from_proto(message.worktrees, cx)?;
self.set_collaborators_from_proto(message.collaborators, cx)?;
self.lsp_store.update(cx, |lsp_store, _| {
lsp_store.set_language_server_statuses_from_proto(message.language_servers)
lsp_store.set_language_server_statuses_from_proto(
message.language_servers,
message.language_server_capabilities,
)
});
self.enqueue_buffer_ordered_message(BufferOrderedMessage::Resync)
.unwrap();