mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
Fix diagnostic pane not being closeable
This commit is contained in:
parent
6f4b6eec5b
commit
e59c8e9d61
@ -33,7 +33,7 @@ use theme::ThemeSettings;
|
|||||||
use util::TryFutureExt;
|
use util::TryFutureExt;
|
||||||
use workspace::{
|
use workspace::{
|
||||||
item::{BreadcrumbText, Item, ItemEvent, ItemHandle},
|
item::{BreadcrumbText, Item, ItemEvent, ItemHandle},
|
||||||
ItemNavHistory, Pane, ToolbarItemLocation, Workspace, PaneBackdrop,
|
ItemNavHistory, Pane, PaneBackdrop, ToolbarItemLocation, Workspace,
|
||||||
};
|
};
|
||||||
|
|
||||||
actions!(diagnostics, [Deploy]);
|
actions!(diagnostics, [Deploy]);
|
||||||
@ -90,12 +90,15 @@ impl View for ProjectDiagnosticsEditor {
|
|||||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> AnyElement<Self> {
|
fn render(&mut self, cx: &mut ViewContext<Self>) -> AnyElement<Self> {
|
||||||
if self.path_states.is_empty() {
|
if self.path_states.is_empty() {
|
||||||
let theme = &theme::current(cx).project_diagnostics;
|
let theme = &theme::current(cx).project_diagnostics;
|
||||||
PaneBackdrop::new(cx.view_id(), Label::new("No problems in workspace", theme.empty_message.clone())
|
PaneBackdrop::new(
|
||||||
.aligned()
|
cx.view_id(),
|
||||||
.contained()
|
Label::new("No problems in workspace", theme.empty_message.clone())
|
||||||
.with_style(theme.container)
|
.aligned()
|
||||||
.into_any()).into_any()
|
.contained()
|
||||||
|
.with_style(theme.container)
|
||||||
|
.into_any(),
|
||||||
|
)
|
||||||
|
.into_any()
|
||||||
} else {
|
} else {
|
||||||
ChildView::new(&self.editor, cx).into_any()
|
ChildView::new(&self.editor, cx).into_any()
|
||||||
}
|
}
|
||||||
@ -162,8 +165,13 @@ impl ProjectDiagnosticsEditor {
|
|||||||
editor.set_vertical_scroll_margin(5, cx);
|
editor.set_vertical_scroll_margin(5, cx);
|
||||||
editor
|
editor
|
||||||
});
|
});
|
||||||
cx.subscribe(&editor, |_, _, event, cx| cx.emit(event.clone()))
|
cx.subscribe(&editor, |this, _, event, cx| {
|
||||||
.detach();
|
cx.emit(event.clone());
|
||||||
|
if event == &editor::Event::Focused && this.path_states.is_empty() {
|
||||||
|
cx.focus_self()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.detach();
|
||||||
|
|
||||||
let project = project_handle.read(cx);
|
let project = project_handle.read(cx);
|
||||||
let paths_to_update = project
|
let paths_to_update = project
|
||||||
|
@ -7128,6 +7128,7 @@ pub enum Event {
|
|||||||
BufferEdited,
|
BufferEdited,
|
||||||
Edited,
|
Edited,
|
||||||
Reparsed,
|
Reparsed,
|
||||||
|
Focused,
|
||||||
Blurred,
|
Blurred,
|
||||||
DirtyChanged,
|
DirtyChanged,
|
||||||
Saved,
|
Saved,
|
||||||
@ -7181,6 +7182,7 @@ impl View for Editor {
|
|||||||
fn focus_in(&mut self, _: AnyViewHandle, cx: &mut ViewContext<Self>) {
|
fn focus_in(&mut self, _: AnyViewHandle, cx: &mut ViewContext<Self>) {
|
||||||
if cx.is_self_focused() {
|
if cx.is_self_focused() {
|
||||||
let focused_event = EditorFocused(cx.handle());
|
let focused_event = EditorFocused(cx.handle());
|
||||||
|
cx.emit(Event::Focused);
|
||||||
cx.emit_global(focused_event);
|
cx.emit_global(focused_event);
|
||||||
}
|
}
|
||||||
if let Some(rename) = self.pending_rename.as_ref() {
|
if let Some(rename) = self.pending_rename.as_ref() {
|
||||||
|
Loading…
Reference in New Issue
Block a user