From c33c91b30edc9e026172fa65ccaed17305761a3b Mon Sep 17 00:00:00 2001 From: 0xSwapFeeder Date: Sun, 10 Dec 2023 17:35:16 -0500 Subject: [PATCH] fix(solidity/core/compiler): fixed diagnostic storage and publishing --- .../crates/foundry-compiler-server/src/main.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/toolchains/solidity/core/crates/foundry-compiler-server/src/main.rs b/toolchains/solidity/core/crates/foundry-compiler-server/src/main.rs index f447639a..91877d7d 100644 --- a/toolchains/solidity/core/crates/foundry-compiler-server/src/main.rs +++ b/toolchains/solidity/core/crates/foundry-compiler-server/src/main.rs @@ -11,6 +11,7 @@ use utils::{convert_severity, get_root_path, slashify_path, normalized_slash_pat mod affected_files_store; use affected_files_store::AffectedFilesStore; + #[derive(Debug)] struct State { compiler: Option, @@ -342,13 +343,24 @@ impl Backend { raised_diagnostics: &HashMap>, ) { let mut state = self.state.lock().await; - + eprintln!("Files with errors: {:?}", raised_diagnostics); state .affected_files .add_project_file(project_path.clone(), filepath.clone()); let raised_files = raised_diagnostics.keys().cloned().collect::>(); let without_diagnostics = state.affected_files.fill_affected_files(raised_files, &project_path); + let affected_files = state.affected_files.get_affected_files(&project_path); + drop(state); + let mut without_diagnostics = vec![]; + + for file in affected_files { + if !raised_diagnostics.contains_key(&file) { // if not potential not affected file is not in raised diags + raised_diagnostics.insert(file.clone(), vec![]); + without_diagnostics.push(file); + } + } + self.client .log_message( MessageType::INFO,