Skip to content

Commit a204510

Browse files
authored
editor: Add toggle diagnostics to command palette (#31358)
Follow-up to #30316 This PR adds the `editor: toggle diagnostics` action to the comand palette so that it can also be invoked that way. I also ensures this, the `toggle inline diagnostics` and `toggle minimap` actions are only registered if these are supported by the current editor instance. Release Notes: - N/A
1 parent 34be783 commit a204510

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

crates/editor/src/editor.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15446,8 +15446,7 @@ impl Editor {
1544615446
.max_severity
1544715447
.unwrap_or(self.diagnostics_max_severity);
1544815448

15449-
if self.mode.is_minimap()
15450-
|| !self.inline_diagnostics_enabled()
15449+
if !self.inline_diagnostics_enabled()
1545115450
|| !self.show_inline_diagnostics
1545215451
|| max_severity == DiagnosticSeverity::Off
1545315452
{

crates/editor/src/element.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,15 @@ impl EditorElement {
426426
register_action(editor, window, Editor::toggle_indent_guides);
427427
register_action(editor, window, Editor::toggle_inlay_hints);
428428
register_action(editor, window, Editor::toggle_edit_predictions);
429-
register_action(editor, window, Editor::toggle_inline_diagnostics);
430-
register_action(editor, window, Editor::toggle_minimap);
429+
if editor.read(cx).diagnostics_enabled() {
430+
register_action(editor, window, Editor::toggle_diagnostics);
431+
}
432+
if editor.read(cx).inline_diagnostics_enabled() {
433+
register_action(editor, window, Editor::toggle_inline_diagnostics);
434+
}
435+
if editor.read(cx).supports_minimap(cx) {
436+
register_action(editor, window, Editor::toggle_minimap);
437+
}
431438
register_action(editor, window, hover_popover::hover);
432439
register_action(editor, window, Editor::reveal_in_finder);
433440
register_action(editor, window, Editor::copy_path);

0 commit comments

Comments
 (0)