diff --git a/crates/ide/src/diagnostics.rs b/crates/ide/src/diagnostics.rs index 86171c380a..cb90363ede 100644 --- a/crates/ide/src/diagnostics.rs +++ b/crates/ide/src/diagnostics.rs @@ -561,7 +561,11 @@ pub fn native_diagnostics( } pub fn diagnostics_descriptors<'a>() -> Vec<&'a DiagnosticDescriptor<'a>> { - vec![&cross_node_eval::DESCRIPTOR, &atoms_exhaustion::DESCRIPTOR] + vec![ + &cross_node_eval::DESCRIPTOR, + &atoms_exhaustion::DESCRIPTOR, + &missing_separator::DESCRIPTOR, + ] } pub fn diagnostics_from_descriptors( @@ -663,7 +667,6 @@ pub fn semantic_diagnostics( deprecated_function::deprecated_function(res, sema, file_id); undefined_function::undefined_function(res, sema, file_id); head_mismatch::head_mismatch_semantic(res, sema, file_id); - missing_separator::missing_separator_semantic(res, sema, file_id); } } diff --git a/crates/ide/src/diagnostics/missing_separator.rs b/crates/ide/src/diagnostics/missing_separator.rs index 92324166fd..71764e1bb4 100644 --- a/crates/ide/src/diagnostics/missing_separator.rs +++ b/crates/ide/src/diagnostics/missing_separator.rs @@ -13,6 +13,8 @@ use elp_syntax::ast::ClauseSeparator; use hir::Semantic; use super::make_unexpected_diagnostic; +use super::DiagnosticConditions; +use super::DiagnosticDescriptor; use crate::diagnostics::make_missing_diagnostic; use crate::Diagnostic; @@ -21,11 +23,19 @@ use crate::Diagnostic; // Diagnostic for separators missing in function clauses. // TODO: combine with head_mismatch? -pub(crate) fn missing_separator_semantic( - diagnostics: &mut Vec, - sema: &Semantic, - file_id: FileId, -) { + +pub(crate) static DESCRIPTOR: DiagnosticDescriptor = DiagnosticDescriptor { + conditions: DiagnosticConditions { + experimental: false, + include_generated: true, + include_tests: true, + }, + checker: &|diags, sema, file_id, _ext| { + missing_separator_semantic(diags, sema, file_id); + }, +}; + +fn missing_separator_semantic(diagnostics: &mut Vec, sema: &Semantic, file_id: FileId) { let def_map = sema.def_map(file_id); def_map.get_functions().for_each(|(_, fun_def)| {