Allow to temporarily toggle diagnostics in the editor (#30316)
* Adds a `diagnostics_max_severity: null` editor settings that has previous hardcoded default, `warning` * Make inline diagnostics to inherit this setting by default (can be overridden with its own max_severity setting) * Allows to toggle diagnostics in the editor menu and via new action, `editor::ToggleDiagnostics` Closes https://github.com/zed-industries/zed/issues/4686 Release Notes: - N/A *or* Added/Fixed/Improved ...
This commit is contained in:
parent
9e5d115e72
commit
a8312d623d
12 changed files with 279 additions and 96 deletions
|
@ -181,15 +181,31 @@ pub struct CargoDiagnosticsSettings {
|
|||
pub fetch_cargo_diagnostics: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize, JsonSchema)]
|
||||
#[derive(
|
||||
Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Serialize, Deserialize, JsonSchema,
|
||||
)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum DiagnosticSeverity {
|
||||
// No diagnostics are shown.
|
||||
Off,
|
||||
Error,
|
||||
Warning,
|
||||
Info,
|
||||
Hint,
|
||||
}
|
||||
|
||||
impl DiagnosticSeverity {
|
||||
pub fn into_lsp(self) -> Option<lsp::DiagnosticSeverity> {
|
||||
match self {
|
||||
DiagnosticSeverity::Off => None,
|
||||
DiagnosticSeverity::Error => Some(lsp::DiagnosticSeverity::ERROR),
|
||||
DiagnosticSeverity::Warning => Some(lsp::DiagnosticSeverity::WARNING),
|
||||
DiagnosticSeverity::Info => Some(lsp::DiagnosticSeverity::INFORMATION),
|
||||
DiagnosticSeverity::Hint => Some(lsp::DiagnosticSeverity::HINT),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for InlineDiagnosticsSettings {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue