mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
Fix reporting of build script errors
This commit is contained in:
parent
095df7bc39
commit
0ff2c81bb9
2 changed files with 21 additions and 7 deletions
|
@ -196,6 +196,10 @@ impl WorkspaceBuildScripts {
|
|||
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
pub fn error(&self) -> Option<&str> {
|
||||
self.error.as_deref()
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: File a better way to know if it is a dylib.
|
||||
|
|
|
@ -445,19 +445,29 @@ impl GlobalState {
|
|||
}
|
||||
|
||||
fn fetch_build_data_error(&self) -> Option<String> {
|
||||
let mut buf = String::new();
|
||||
let mut buf = "rust-analyzer failed to run build scripts:\n".to_string();
|
||||
let mut has_errors = false;
|
||||
|
||||
for ws in &self.fetch_build_data_queue.last_op_result().1 {
|
||||
if let Err(err) = ws {
|
||||
stdx::format_to!(buf, "rust-analyzer failed to run custom build: {:#}\n", err);
|
||||
match ws {
|
||||
Ok(data) => {
|
||||
if let Some(err) = data.error() {
|
||||
has_errors = true;
|
||||
stdx::format_to!(buf, "{:#}\n", err);
|
||||
}
|
||||
}
|
||||
Err(err) => {
|
||||
has_errors = true;
|
||||
stdx::format_to!(buf, "{:#}\n", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if buf.is_empty() {
|
||||
return None;
|
||||
}
|
||||
|
||||
if has_errors {
|
||||
Some(buf)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
fn reload_flycheck(&mut self) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue