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:
parent
858e176a1c
commit
050ed85d71
12 changed files with 312 additions and 51 deletions
|
@ -1,6 +1,7 @@
|
|||
//! This module contains all actions supported by [`Editor`].
|
||||
use super::*;
|
||||
use gpui::{Action, actions};
|
||||
use project::project_settings::GoToDiagnosticSeverityFilter;
|
||||
use schemars::JsonSchema;
|
||||
use util::serde::default_true;
|
||||
|
||||
|
@ -265,6 +266,24 @@ pub enum UuidVersion {
|
|||
V7,
|
||||
}
|
||||
|
||||
/// Goes to the next diagnostic in the file.
|
||||
#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
|
||||
#[action(namespace = editor)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct GoToDiagnostic {
|
||||
#[serde(default)]
|
||||
pub severity: GoToDiagnosticSeverityFilter,
|
||||
}
|
||||
|
||||
/// Goes to the previous diagnostic in the file.
|
||||
#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
|
||||
#[action(namespace = editor)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct GoToPreviousDiagnostic {
|
||||
#[serde(default)]
|
||||
pub severity: GoToDiagnosticSeverityFilter,
|
||||
}
|
||||
|
||||
actions!(
|
||||
debugger,
|
||||
[
|
||||
|
@ -424,8 +443,6 @@ actions!(
|
|||
GoToDefinition,
|
||||
/// Goes to definition in a split pane.
|
||||
GoToDefinitionSplit,
|
||||
/// Goes to the next diagnostic in the file.
|
||||
GoToDiagnostic,
|
||||
/// Goes to the next diff hunk.
|
||||
GoToHunk,
|
||||
/// Goes to the previous diff hunk.
|
||||
|
@ -440,8 +457,6 @@ actions!(
|
|||
GoToParentModule,
|
||||
/// Goes to the previous change in the file.
|
||||
GoToPreviousChange,
|
||||
/// Goes to the previous diagnostic in the file.
|
||||
GoToPreviousDiagnostic,
|
||||
/// Goes to the type definition of the symbol at cursor.
|
||||
GoToTypeDefinition,
|
||||
/// Goes to type definition in a split pane.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue