Skip to content

Commit

Permalink
Add Diagnostics key context (#23043)
Browse files Browse the repository at this point in the history
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"
    }
}
```
  • Loading branch information
everdrone authored Jan 13, 2025
1 parent 955248f commit 1c6dd03
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions crates/diagnostics/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ impl Render for ProjectDiagnosticsEditor {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
let child = if self.path_states.is_empty() {
div()
.key_context("EmptyPane")
.bg(cx.theme().colors().editor_background)
.flex()
.items_center()
Expand All @@ -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)
Expand Down

0 comments on commit 1c6dd03

Please sign in to comment.