Reintroduce LSP diagnostic/status message (#3728)

Release Notes:

- N/A
This commit is contained in:
Julia 2023-12-20 12:23:36 -05:00 committed by GitHub
commit e1a4e8ea16
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 68 additions and 29 deletions

View file

@ -789,6 +789,7 @@ impl Pane {
}
self.update_toolbar(cx);
self.update_status_bar(cx);
if focus_item {
self.focus_active_item(cx);
@ -1450,6 +1451,22 @@ impl Pane {
});
}
fn update_status_bar(&mut self, cx: &mut ViewContext<Self>) {
let workspace = self.workspace.clone();
let pane = cx.view().clone();
cx.window_context().defer(move |cx| {
let Ok(status_bar) = workspace.update(cx, |workspace, _| workspace.status_bar.clone())
else {
return;
};
status_bar.update(cx, move |status_bar, cx| {
status_bar.set_active_pane(&pane, cx);
});
});
}
fn render_tab(
&self,
ix: usize,

View file

@ -83,6 +83,9 @@ impl StatusBar {
where
T: 'static + StatusItemView,
{
let active_pane_item = self.active_pane.read(cx).active_item();
item.set_active_pane_item(active_pane_item.as_deref(), cx);
self.left_items.push(Box::new(item));
cx.notify();
}
@ -119,6 +122,9 @@ impl StatusBar {
) where
T: 'static + StatusItemView,
{
let active_pane_item = self.active_pane.read(cx).active_item();
item.set_active_pane_item(active_pane_item.as_deref(), cx);
if position < self.left_items.len() {
self.left_items.insert(position + 1, Box::new(item))
} else {
@ -141,6 +147,9 @@ impl StatusBar {
where
T: 'static + StatusItemView,
{
let active_pane_item = self.active_pane.read(cx).active_item();
item.set_active_pane_item(active_pane_item.as_deref(), cx);
self.right_items.push(Box::new(item));
cx.notify();
}