Register log-related actions for all kinds of projects

This commit is contained in:
Kirill Bulatov 2025-08-23 15:43:25 +03:00
parent dc6377b8bc
commit 9d1e2f5278

View file

@ -245,27 +245,21 @@ pub fn init(client: AnyProtoClient, store_logs: bool, cx: &mut App) {
cx.set_global(GlobalLogStore(log_store.downgrade()));
cx.observe_new(move |workspace: &mut Workspace, _, cx| {
let project = workspace.project();
if project.read(cx).is_local() || project.read(cx).is_via_ssh() {
log_store.update(cx, |store, cx| {
store.add_project(project, cx);
});
}
log_store.update(cx, |store, cx| {
store.add_project(workspace.project(), cx);
});
let log_store = log_store.clone();
workspace.register_action(move |workspace, _: &OpenLanguageServerLogs, window, cx| {
let project = workspace.project().read(cx);
if project.is_local() || project.is_via_ssh() {
let project = workspace.project().clone();
let log_store = log_store.clone();
get_or_create_tool(
workspace,
SplitDirection::Right,
window,
cx,
move |window, cx| LspLogView::new(project, log_store, window, cx),
);
}
let log_store = log_store.clone();
let project = workspace.project().clone();
get_or_create_tool(
workspace,
SplitDirection::Right,
window,
cx,
move |window, cx| LspLogView::new(project, log_store, window, cx),
);
});
})
.detach();