feat: improve performance by delaying computation of fixes for diagnostics

This commit is contained in:
Aleksey Kladov 2021-04-13 11:48:12 +03:00
parent 04b5fcfdb2
commit 06a633ff42
7 changed files with 74 additions and 40 deletions

View file

@ -57,7 +57,8 @@ pub fn diagnostics(
let crate_name =
module.krate().display_name(db).as_deref().unwrap_or("unknown").to_string();
println!("processing crate: {}, module: {}", crate_name, _vfs.file_path(file_id));
for diagnostic in analysis.diagnostics(&DiagnosticsConfig::default(), file_id).unwrap()
for diagnostic in
analysis.diagnostics(&DiagnosticsConfig::default(), false, file_id).unwrap()
{
if matches!(diagnostic.severity, Severity::Error) {
found_error = true;

View file

@ -1182,7 +1182,7 @@ pub(crate) fn publish_diagnostics(
let diagnostics: Vec<Diagnostic> = snap
.analysis
.diagnostics(&snap.config.diagnostics(), file_id)?
.diagnostics(&snap.config.diagnostics(), false, file_id)?
.into_iter()
.map(|d| Diagnostic {
range: to_proto::range(&line_index, d.range),

View file

@ -168,6 +168,7 @@ impl Server {
self.send_notification(r)
}
#[track_caller]
pub(crate) fn request<R>(&self, params: R::Params, expected_resp: Value)
where
R: lsp_types::request::Request,