Skip to content

Commit 5be0804

Browse files
Properly fill remote client's log store
1 parent 53a6c7a commit 5be0804

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

crates/language_tools/src/lsp_log.rs

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ use lsp::{
1313
MessageType, SetTraceParams, TraceValue, notification::SetTrace,
1414
};
1515
use project::{
16-
LspStore, Project, WorktreeId, lsp_store::LanguageServerLogType, search::SearchQuery,
16+
LspStore, Project, ProjectItem, WorktreeId, lsp_store::LanguageServerLogType,
17+
search::SearchQuery,
1718
};
1819
use std::{any::TypeId, borrow::Cow, sync::Arc};
1920
use ui::{Button, Checkbox, ContextMenu, Label, PopoverMenu, ToggleState, prelude::*};
@@ -377,6 +378,36 @@ impl LogStore {
377378
cx,
378379
);
379380
}
381+
project::Event::LanguageServerBufferRegistered {
382+
server_id,
383+
buffer_id,
384+
name,
385+
..
386+
} if project.read(cx).is_via_collab() => {
387+
let worktree_id = project
388+
.read(cx)
389+
.buffer_for_id(*buffer_id, cx)
390+
.and_then(|buffer| {
391+
Some(buffer.read(cx).project_path(cx)?.worktree_id)
392+
});
393+
let name = name.clone().or_else(|| {
394+
project
395+
.read(cx)
396+
.lsp_store()
397+
.read(cx)
398+
.language_server_statuses
399+
.get(server_id)
400+
.map(|status| status.name.clone())
401+
});
402+
log_store.add_language_server(
403+
server_kind,
404+
*server_id,
405+
name,
406+
worktree_id,
407+
None,
408+
cx,
409+
);
410+
}
380411
project::Event::LanguageServerRemoved(id) => {
381412
log_store.remove_language_server(*id, cx);
382413
}

crates/project/src/project.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ pub enum Event {
280280
server_id: LanguageServerId,
281281
buffer_id: BufferId,
282282
buffer_abs_path: PathBuf,
283+
name: Option<LanguageServerName>,
283284
},
284285
Toast {
285286
notification_id: SharedString,
@@ -2971,6 +2972,7 @@ impl Project {
29712972
buffer_id,
29722973
server_id: *language_server_id,
29732974
buffer_abs_path: PathBuf::from(&update.buffer_abs_path),
2975+
name: name.clone(),
29742976
});
29752977
}
29762978
}

crates/project/src/project_tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1951,6 +1951,7 @@ async fn test_restarting_server_with_diagnostics_running(cx: &mut gpui::TestAppC
19511951
server_id: LanguageServerId(1),
19521952
buffer_id,
19531953
buffer_abs_path: PathBuf::from(path!("/dir/a.rs")),
1954+
name: Some(fake_server.server.name())
19541955
}
19551956
);
19561957
assert_eq!(

0 commit comments

Comments
 (0)