Add severity argument to GoToDiagnostic actions (#33995)

This PR adds a `severity` argument so severity can be defined when
navigating through diagnostics. This allows keybinds like the following:

```json
{
  "] e": ["editor::GoToDiagnostic", { "severity": "error" }],
  "[ e": ["editor::GoToDiagnostic", { "severity": "error" }]
}
```

I've added test comments and a test. Let me know if there's anything
else you need!

Release Notes:

- Add `severity` argument to `editor::GoToDiagnostic`,
`editor::GoToPreviousDiagnostic`, `project_panel::SelectNextDiagnostic`
and `project_panel::SelectPrevDiagnostic` actions
This commit is contained in:
Hilmar Wiegand 2025-07-15 16:03:57 +02:00 committed by GitHub
parent 858e176a1c
commit 050ed85d71
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 312 additions and 51 deletions

View file

@ -199,8 +199,11 @@ pub fn app_menus() -> Vec<Menu> {
MenuItem::action("Go to Type Definition", editor::actions::GoToTypeDefinition),
MenuItem::action("Find All References", editor::actions::FindAllReferences),
MenuItem::separator(),
MenuItem::action("Next Problem", editor::actions::GoToDiagnostic),
MenuItem::action("Previous Problem", editor::actions::GoToPreviousDiagnostic),
MenuItem::action("Next Problem", editor::actions::GoToDiagnostic::default()),
MenuItem::action(
"Previous Problem",
editor::actions::GoToPreviousDiagnostic::default(),
),
],
},
Menu {

View file

@ -255,8 +255,11 @@ impl Render for QuickActionBar {
.action("Go to Symbol", Box::new(ToggleOutline))
.action("Go to Line/Column", Box::new(ToggleGoToLine))
.separator()
.action("Next Problem", Box::new(GoToDiagnostic))
.action("Previous Problem", Box::new(GoToPreviousDiagnostic))
.action("Next Problem", Box::new(GoToDiagnostic::default()))
.action(
"Previous Problem",
Box::new(GoToPreviousDiagnostic::default()),
)
.separator()
.action_disabled_when(!has_diff_hunks, "Next Hunk", Box::new(GoToHunk))
.action_disabled_when(