Take 2: https://github.com/zed-industries/zed/pull/36709 but without the very bad `cfg`-based approach for storing the RPC logs. -------------- Enables LSP log tracing in both remote collab and remote ssh environments. Server logs and server RPC traces can now be viewed remotely, and the LSP button is now shown in such projects too. Closes https://github.com/zed-industries/zed/issues/28557 Co-Authored-By: Kirill <kirill@zed.dev> Co-Authored-By: Lukas <lukas@zed.dev> Release Notes: - Enabled LSP log tracing in both remote collab and remote ssh environments --------- Co-authored-by: Ben Kunkle <ben@zed.dev> Co-authored-by: Lukas Wirth <lukas@zed.dev>
55 lines
1.3 KiB
Rust
55 lines
1.3 KiB
Rust
mod key_context_view;
|
|
pub mod lsp_button;
|
|
pub mod lsp_log_view;
|
|
mod syntax_tree_view;
|
|
|
|
#[cfg(test)]
|
|
mod lsp_log_view_tests;
|
|
|
|
use gpui::{App, AppContext, Entity};
|
|
|
|
pub use lsp_log_view::LspLogView;
|
|
pub use syntax_tree_view::{SyntaxTreeToolbarItemView, SyntaxTreeView};
|
|
use ui::{Context, Window};
|
|
use workspace::{Item, ItemHandle, SplitDirection, Workspace};
|
|
|
|
pub fn init(cx: &mut App) {
|
|
lsp_log_view::init(true, cx);
|
|
syntax_tree_view::init(cx);
|
|
key_context_view::init(cx);
|
|
}
|
|
|
|
fn get_or_create_tool<T>(
|
|
workspace: &mut Workspace,
|
|
destination: SplitDirection,
|
|
window: &mut Window,
|
|
cx: &mut Context<Workspace>,
|
|
new_tool: impl FnOnce(&mut Window, &mut Context<T>) -> T,
|
|
) -> Entity<T>
|
|
where
|
|
T: Item,
|
|
{
|
|
if let Some(item) = workspace.item_of_type::<T>(cx) {
|
|
return item;
|
|
}
|
|
|
|
let new_tool = cx.new(|cx| new_tool(window, cx));
|
|
match workspace.find_pane_in_direction(destination, cx) {
|
|
Some(right_pane) => {
|
|
workspace.add_item(
|
|
right_pane,
|
|
new_tool.boxed_clone(),
|
|
None,
|
|
true,
|
|
true,
|
|
window,
|
|
cx,
|
|
);
|
|
}
|
|
None => {
|
|
workspace.split_item(destination, new_tool.boxed_clone(), window, cx);
|
|
}
|
|
}
|
|
new_tool
|
|
}
|