From 1c6dd03e50ba7a395303c7b557bd7463639de5d0 Mon Sep 17 00:00:00 2001 From: everdrone Date: Mon, 13 Jan 2025 17:07:04 +0100 Subject: [PATCH] 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" } } ``` --- crates/diagnostics/src/diagnostics.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/crates/diagnostics/src/diagnostics.rs b/crates/diagnostics/src/diagnostics.rs index 43464310ed8047dc80a1d6ef3f8e76a2ad9caf93..71f96e9f9bc31e2f841db0949a1319a02e37dea6 100644 --- a/crates/diagnostics/src/diagnostics.rs +++ b/crates/diagnostics/src/diagnostics.rs @@ -95,6 +95,7 @@ impl Render for ProjectDiagnosticsEditor { fn render(&mut self, cx: &mut ViewContext) -> impl IntoElement { let child = if self.path_states.is_empty() { div() + .key_context("EmptyPane") .bg(cx.theme().colors().editor_background) .flex() .items_center() @@ -106,10 +107,8 @@ impl Render for ProjectDiagnosticsEditor { }; div() + .key_context("Diagnostics") .track_focus(&self.focus_handle(cx)) - .when(self.path_states.is_empty(), |el| { - el.key_context("EmptyPane") - }) .size_full() .on_action(cx.listener(Self::toggle_warnings)) .child(child)