When clicking the checkbox, toggle open the LSP trace logs (#8689)

Before this change, enabling LSP trace checkbox closed the panel and
toggled the server logs on.
Now, the newly enabled trace logs are shown instead.

Release Notes:

- Improved LSP logs checkbox behavior
This commit is contained in:
Kirill Bulatov 2024-03-02 02:03:30 +02:00 committed by GitHub
parent 268fa1cbaf
commit b7784d414a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -823,7 +823,7 @@ impl Render for LspLogToolbarItemView {
selection, selection,
Selection::Selected Selection::Selected
); );
view.toggle_logging_for_server( view.toggle_rpc_logging_for_server(
row.server_id, row.server_id,
enabled, enabled,
cx, cx,
@ -887,7 +887,7 @@ impl LspLogToolbarItemView {
} }
} }
fn toggle_logging_for_server( fn toggle_rpc_logging_for_server(
&mut self, &mut self,
id: LanguageServerId, id: LanguageServerId,
enabled: bool, enabled: bool,
@ -899,6 +899,9 @@ impl LspLogToolbarItemView {
if !enabled && Some(id) == log_view.current_server_id { if !enabled && Some(id) == log_view.current_server_id {
log_view.show_logs_for_server(id, cx); log_view.show_logs_for_server(id, cx);
cx.notify(); cx.notify();
} else if enabled {
log_view.show_rpc_trace_for_server(id, cx);
cx.notify();
} }
cx.focus(&log_view.focus_handle); cx.focus(&log_view.focus_handle);
}); });