Only display experimental diagnostics when enabled

This commit is contained in:
Jonas Schievink
2020-07-24 17:39:44 +02:00
parent f6f49735e8
commit 92a4ec80a0
5 changed files with 22 additions and 11 deletions

View File

@@ -70,7 +70,7 @@ pub fn analysis_bench(
match &what {
BenchWhat::Highlight { .. } => {
let res = do_work(&mut host, file_id, |analysis| {
analysis.diagnostics(file_id).unwrap();
analysis.diagnostics(file_id, true).unwrap();
analysis.highlight_as_html(file_id, false).unwrap()
});
if verbosity.is_verbose() {

View File

@@ -47,7 +47,7 @@ pub fn diagnostics(
String::from("unknown")
};
println!("processing crate: {}, module: {}", crate_name, _vfs.file_path(file_id));
for diagnostic in analysis.diagnostics(file_id).unwrap() {
for diagnostic in analysis.diagnostics(file_id, true).unwrap() {
if matches!(diagnostic.severity, Severity::Error) {
found_error = true;
}

View File

@@ -774,7 +774,7 @@ fn handle_fixes(
None => {}
};
let diagnostics = snap.analysis.diagnostics(file_id)?;
let diagnostics = snap.analysis.diagnostics(file_id, snap.config.experimental_diagnostics)?;
let fixes_from_diagnostics = diagnostics
.into_iter()
@@ -1040,7 +1040,7 @@ pub(crate) fn publish_diagnostics(
let line_index = snap.analysis.file_line_index(file_id)?;
let diagnostics: Vec<Diagnostic> = snap
.analysis
.diagnostics(file_id)?
.diagnostics(file_id, snap.config.experimental_diagnostics)?
.into_iter()
.map(|d| Diagnostic {
range: to_proto::range(&line_index, d.range),