Align diagnostics config with the rest of rust-analyzer

This commit is contained in:
Aleksey Kladov
2020-08-18 16:03:15 +02:00
parent b8dfc331ab
commit 0866b1be89
10 changed files with 93 additions and 98 deletions

View File

@@ -7,7 +7,10 @@ use base_db::{
salsa::{Database, Durability},
FileId,
};
use ide::{Analysis, AnalysisChange, AnalysisHost, CompletionConfig, FilePosition, LineCol};
use ide::{
Analysis, AnalysisChange, AnalysisHost, CompletionConfig, DiagnosticsConfig, FilePosition,
LineCol,
};
use vfs::AbsPathBuf;
use crate::{
@@ -71,7 +74,7 @@ impl BenchCmd {
match &self.what {
BenchWhat::Highlight { .. } => {
let res = do_work(&mut host, file_id, |analysis| {
analysis.diagnostics(file_id, true, None).unwrap();
analysis.diagnostics(&DiagnosticsConfig::default(), file_id).unwrap();
analysis.highlight_as_html(file_id, false).unwrap()
});
if verbosity.is_verbose() {

View File

@@ -8,7 +8,7 @@ use rustc_hash::FxHashSet;
use base_db::SourceDatabaseExt;
use hir::Crate;
use ide::Severity;
use ide::{DiagnosticsConfig, Severity};
use crate::cli::{load_cargo::load_cargo, Result};
@@ -47,7 +47,8 @@ pub fn diagnostics(
String::from("unknown")
};
println!("processing crate: {}, module: {}", crate_name, _vfs.file_path(file_id));
for diagnostic in analysis.diagnostics(file_id, true, None).unwrap() {
for diagnostic in analysis.diagnostics(&DiagnosticsConfig::default(), file_id).unwrap()
{
if matches!(diagnostic.severity, Severity::Error) {
found_error = true;
}