First pass on fixes

This commit is contained in:
Piotr Osiewicz 2025-08-19 14:23:59 +02:00
parent 5826d89b97
commit 2f3be75fc7
269 changed files with 1593 additions and 2574 deletions

View file

@ -254,8 +254,8 @@ impl LogStore {
let copilot_subscription = Copilot::global(cx).map(|copilot| {
let copilot = &copilot;
cx.subscribe(copilot, |this, copilot, edit_prediction_event, cx| {
if let copilot::Event::CopilotLanguageServerStarted = edit_prediction_event {
if let Some(server) = copilot.read(cx).language_server() {
if let copilot::Event::CopilotLanguageServerStarted = edit_prediction_event
&& let Some(server) = copilot.read(cx).language_server() {
let server_id = server.server_id();
let weak_this = cx.weak_entity();
this.copilot_log_subscription =
@ -283,7 +283,6 @@ impl LogStore {
cx,
);
}
}
})
});
@ -733,8 +732,8 @@ impl LspLogView {
let first_server_id_for_project =
store.read(cx).server_ids_for_project(&weak_project).next();
if let Some(current_lsp) = this.current_server_id {
if !store.read(cx).language_servers.contains_key(&current_lsp) {
if let Some(server_id) = first_server_id_for_project {
if !store.read(cx).language_servers.contains_key(&current_lsp)
&& let Some(server_id) = first_server_id_for_project {
match this.active_entry_kind {
LogKind::Rpc => {
this.show_rpc_trace_for_server(server_id, window, cx)
@ -744,7 +743,6 @@ impl LspLogView {
LogKind::ServerInfo => this.show_server_info(server_id, window, cx),
}
}
}
} else if let Some(server_id) = first_server_id_for_project {
match this.active_entry_kind {
LogKind::Rpc => this.show_rpc_trace_for_server(server_id, window, cx),
@ -776,11 +774,10 @@ impl LspLogView {
],
cx,
);
if text.len() > 1024 {
if let Some((fold_offset, _)) =
if text.len() > 1024
&& let Some((fold_offset, _)) =
text.char_indices().dropping(1024).next()
{
if fold_offset < text.len() {
&& fold_offset < text.len() {
editor.fold_ranges(
vec![
last_offset + fold_offset..last_offset + text.len(),
@ -790,8 +787,6 @@ impl LspLogView {
cx,
);
}
}
}
if newest_cursor_is_at_end {
editor.request_autoscroll(Autoscroll::bottom(), cx);
@ -1311,15 +1306,14 @@ impl ToolbarItemView for LspLogToolbarItemView {
_: &mut Window,
cx: &mut Context<Self>,
) -> workspace::ToolbarItemLocation {
if let Some(item) = active_pane_item {
if let Some(log_view) = item.downcast::<LspLogView>() {
if let Some(item) = active_pane_item
&& let Some(log_view) = item.downcast::<LspLogView>() {
self.log_view = Some(log_view.clone());
self._log_view_subscription = Some(cx.observe(&log_view, |_, _, cx| {
cx.notify();
}));
return ToolbarItemLocation::PrimaryLeft;
}
}
self.log_view = None;
self._log_view_subscription = None;
ToolbarItemLocation::Hidden

View file

@ -103,13 +103,11 @@ impl SyntaxTreeView {
window: &mut Window,
cx: &mut Context<Self>,
) {
if let Some(item) = active_item {
if item.item_id() != cx.entity_id() {
if let Some(editor) = item.act_as::<Editor>(cx) {
if let Some(item) = active_item
&& item.item_id() != cx.entity_id()
&& let Some(editor) = item.act_as::<Editor>(cx) {
self.set_editor(editor, window, cx);
}
}
}
}
fn set_editor(&mut self, editor: Entity<Editor>, window: &mut Window, cx: &mut Context<Self>) {
@ -537,13 +535,12 @@ impl ToolbarItemView for SyntaxTreeToolbarItemView {
window: &mut Window,
cx: &mut Context<Self>,
) -> ToolbarItemLocation {
if let Some(item) = active_pane_item {
if let Some(view) = item.downcast::<SyntaxTreeView>() {
if let Some(item) = active_pane_item
&& let Some(view) = item.downcast::<SyntaxTreeView>() {
self.tree_view = Some(view.clone());
self.subscription = Some(cx.observe_in(&view, window, |_, _, _, cx| cx.notify()));
return ToolbarItemLocation::PrimaryLeft;
}
}
self.tree_view = None;
self.subscription = None;
ToolbarItemLocation::Hidden