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.set_global(GlobalLogStore(log_store.downgrade()));
cx.observe_new(move |workspace: &mut Workspace, _, cx| { cx.observe_new(move |workspace: &mut Workspace, _, cx| {
let project = workspace.project(); log_store.update(cx, |store, cx| {
if project.read(cx).is_local() || project.read(cx).is_via_ssh() { store.add_project(workspace.project(), cx);
log_store.update(cx, |store, cx| { });
store.add_project(project, cx);
});
}
let log_store = log_store.clone(); let log_store = log_store.clone();
workspace.register_action(move |workspace, _: &OpenLanguageServerLogs, window, cx| { workspace.register_action(move |workspace, _: &OpenLanguageServerLogs, window, cx| {
let project = workspace.project().read(cx); let log_store = log_store.clone();
if project.is_local() || project.is_via_ssh() { let project = workspace.project().clone();
let project = workspace.project().clone(); get_or_create_tool(
let log_store = log_store.clone(); workspace,
get_or_create_tool( SplitDirection::Right,
workspace, window,
SplitDirection::Right, cx,
window, move |window, cx| LspLogView::new(project, log_store, window, cx),
cx, );
move |window, cx| LspLogView::new(project, log_store, window, cx),
);
}
}); });
}) })
.detach(); .detach();