One less remote usage
This commit is contained in:
parent
775160a199
commit
d433406103
2 changed files with 52 additions and 60 deletions
|
@ -135,12 +135,6 @@ pub enum LanguageServerKind {
|
||||||
Global,
|
Global,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl LanguageServerKind {
|
|
||||||
fn is_remote(&self) -> bool {
|
|
||||||
matches!(self, LanguageServerKind::Remote { .. })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl std::fmt::Debug for LanguageServerKind {
|
impl std::fmt::Debug for LanguageServerKind {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
|
@ -1160,6 +1154,7 @@ impl LspLogView {
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) {
|
) {
|
||||||
|
self.toggle_rpc_trace_for_server(server_id, true, window, cx);
|
||||||
let rpc_log = self.log_store.update(cx, |log_store, _| {
|
let rpc_log = self.log_store.update(cx, |log_store, _| {
|
||||||
log_store
|
log_store
|
||||||
.enable_rpc_trace_for_language_server(server_id)
|
.enable_rpc_trace_for_language_server(server_id)
|
||||||
|
@ -1597,7 +1592,6 @@ impl Render for LspLogToolbarItemView {
|
||||||
|
|
||||||
let view_selector = current_server.map(|server| {
|
let view_selector = current_server.map(|server| {
|
||||||
let server_id = server.server_id;
|
let server_id = server.server_id;
|
||||||
let is_remote = server.server_kind.is_remote();
|
|
||||||
let rpc_trace_enabled = server.rpc_trace_enabled;
|
let rpc_trace_enabled = server.rpc_trace_enabled;
|
||||||
let log_view = log_view.clone();
|
let log_view = log_view.clone();
|
||||||
PopoverMenu::new("LspViewSelector")
|
PopoverMenu::new("LspViewSelector")
|
||||||
|
@ -1619,55 +1613,53 @@ impl Render for LspLogToolbarItemView {
|
||||||
view.show_logs_for_server(server_id, window, cx);
|
view.show_logs_for_server(server_id, window, cx);
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.when(!is_remote, |this| {
|
.entry(
|
||||||
this.entry(
|
SERVER_TRACE,
|
||||||
SERVER_TRACE,
|
None,
|
||||||
None,
|
window.handler_for(&log_view, move |view, window, cx| {
|
||||||
window.handler_for(&log_view, move |view, window, cx| {
|
view.show_trace_for_server(server_id, window, cx);
|
||||||
view.show_trace_for_server(server_id, window, cx);
|
}),
|
||||||
}),
|
)
|
||||||
)
|
.custom_entry(
|
||||||
.custom_entry(
|
{
|
||||||
{
|
let log_toolbar_view = log_toolbar_view.clone();
|
||||||
let log_toolbar_view = log_toolbar_view.clone();
|
move |window, _| {
|
||||||
move |window, _| {
|
h_flex()
|
||||||
h_flex()
|
.w_full()
|
||||||
.w_full()
|
.justify_between()
|
||||||
.justify_between()
|
.child(Label::new(RPC_MESSAGES))
|
||||||
.child(Label::new(RPC_MESSAGES))
|
.child(
|
||||||
.child(
|
div().child(
|
||||||
div().child(
|
Checkbox::new(
|
||||||
Checkbox::new(
|
"LspLogEnableRpcTrace",
|
||||||
"LspLogEnableRpcTrace",
|
if rpc_trace_enabled {
|
||||||
if rpc_trace_enabled {
|
ToggleState::Selected
|
||||||
|
} else {
|
||||||
|
ToggleState::Unselected
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.on_click(window.listener_for(
|
||||||
|
&log_toolbar_view,
|
||||||
|
move |view, selection, window, cx| {
|
||||||
|
let enabled = matches!(
|
||||||
|
selection,
|
||||||
ToggleState::Selected
|
ToggleState::Selected
|
||||||
} else {
|
);
|
||||||
ToggleState::Unselected
|
view.toggle_rpc_logging_for_server(
|
||||||
},
|
server_id, enabled, window, cx,
|
||||||
)
|
);
|
||||||
.on_click(window.listener_for(
|
cx.stop_propagation();
|
||||||
&log_toolbar_view,
|
},
|
||||||
move |view, selection, window, cx| {
|
)),
|
||||||
let enabled = matches!(
|
),
|
||||||
selection,
|
)
|
||||||
ToggleState::Selected
|
.into_any_element()
|
||||||
);
|
}
|
||||||
view.toggle_rpc_logging_for_server(
|
},
|
||||||
server_id, enabled, window, cx,
|
window.handler_for(&log_view, move |view, window, cx| {
|
||||||
);
|
view.show_rpc_trace_for_server(server_id, window, cx);
|
||||||
cx.stop_propagation();
|
}),
|
||||||
},
|
)
|
||||||
)),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.into_any_element()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
window.handler_for(&log_view, move |view, window, cx| {
|
|
||||||
view.show_rpc_trace_for_server(server_id, window, cx);
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
})
|
|
||||||
.entry(
|
.entry(
|
||||||
SERVER_INFO,
|
SERVER_INFO,
|
||||||
None,
|
None,
|
||||||
|
|
|
@ -500,7 +500,7 @@ impl HeadlessProject {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn handle_open_server_settings(
|
async fn handle_open_server_settings(
|
||||||
this: Entity<Self>,
|
this: Entity<Self>,
|
||||||
_: TypedEnvelope<proto::OpenServerSettings>,
|
_: TypedEnvelope<proto::OpenServerSettings>,
|
||||||
mut cx: AsyncApp,
|
mut cx: AsyncApp,
|
||||||
|
@ -553,7 +553,7 @@ impl HeadlessProject {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn handle_find_search_candidates(
|
async fn handle_find_search_candidates(
|
||||||
this: Entity<Self>,
|
this: Entity<Self>,
|
||||||
envelope: TypedEnvelope<proto::FindSearchCandidates>,
|
envelope: TypedEnvelope<proto::FindSearchCandidates>,
|
||||||
mut cx: AsyncApp,
|
mut cx: AsyncApp,
|
||||||
|
@ -585,7 +585,7 @@ impl HeadlessProject {
|
||||||
Ok(response)
|
Ok(response)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn handle_list_remote_directory(
|
async fn handle_list_remote_directory(
|
||||||
this: Entity<Self>,
|
this: Entity<Self>,
|
||||||
envelope: TypedEnvelope<proto::ListRemoteDirectory>,
|
envelope: TypedEnvelope<proto::ListRemoteDirectory>,
|
||||||
cx: AsyncApp,
|
cx: AsyncApp,
|
||||||
|
@ -617,7 +617,7 @@ impl HeadlessProject {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn handle_get_path_metadata(
|
async fn handle_get_path_metadata(
|
||||||
this: Entity<Self>,
|
this: Entity<Self>,
|
||||||
envelope: TypedEnvelope<proto::GetPathMetadata>,
|
envelope: TypedEnvelope<proto::GetPathMetadata>,
|
||||||
cx: AsyncApp,
|
cx: AsyncApp,
|
||||||
|
@ -635,7 +635,7 @@ impl HeadlessProject {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn handle_shutdown_remote_server(
|
async fn handle_shutdown_remote_server(
|
||||||
_this: Entity<Self>,
|
_this: Entity<Self>,
|
||||||
_envelope: TypedEnvelope<proto::ShutdownRemoteServer>,
|
_envelope: TypedEnvelope<proto::ShutdownRemoteServer>,
|
||||||
cx: AsyncApp,
|
cx: AsyncApp,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue