Skip to content

Commit 1c6dd03

Browse files
authored
Add Diagnostics key context (#23043)
Closes #17337 Release Notes: - Add `Diagnostics` key context - Enables users to specify key bindings for that pane ```json { "context": "Diagnostics", "bindings": { "alt-q": "diagnostics::ToggleWarnings" } } ```
1 parent 955248f commit 1c6dd03

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

crates/diagnostics/src/diagnostics.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ impl Render for ProjectDiagnosticsEditor {
9595
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
9696
let child = if self.path_states.is_empty() {
9797
div()
98+
.key_context("EmptyPane")
9899
.bg(cx.theme().colors().editor_background)
99100
.flex()
100101
.items_center()
@@ -106,10 +107,8 @@ impl Render for ProjectDiagnosticsEditor {
106107
};
107108

108109
div()
110+
.key_context("Diagnostics")
109111
.track_focus(&self.focus_handle(cx))
110-
.when(self.path_states.is_empty(), |el| {
111-
el.key_context("EmptyPane")
112-
})
113112
.size_full()
114113
.on_action(cx.listener(Self::toggle_warnings))
115114
.child(child)

0 commit comments

Comments
 (0)