-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
In some situations, rust analyzer 0.2.416 won't output any error messages in VSCode.
How to reproduce :
- Initialize a new repo with
cargo new --bin. - Have a
main.rswith following source code:
struct SomeStruct {
value: u32
}
impl SomeStruct {
fn compute_something(&self,
n: u32) -> u32 {
self.value + n
}
}
fn compute_something_else(a: u16,
b: u16,
c: u16,
d: u16,
e: u16,
f: u16,
g: u16) -> u32 {
u32::from(a)
+ u32::from(b)
+ u32::from(c)
+ u32::from(d)
+ u32::from(e)
+ u32::from(f)
+ u32::from(g)
}
fn main() {
let some_struct: SomeStruct = SomeStruct {value: 10};
let value: u32 = some_struct
.compute_something(compute_something_else(
1,
2,
3,
4,
5,
6
));
println!("{}", value);
}
(Notice the missing argument for the compute_something_else function)
- (Re-)open the workspace created by cargo in VSCode.
- rust-analyzer fails to output any error message after loading the workspace. Dev tools output the following message
[Extension Host] Notification handler 'textDocument/publishDiagnostics' failed with message: message must be set
at console.ts:137.
Making any modification appears to make rust-analyzer able to show errors it found again, but rust-analyzer still won't output errors found by cargo check. Not sure if related, but in my own (huge, local, private) repo, rust-analyzer cannot find errors by itself either.
After some debugging (on Windows), I found out that an exception is raised in file C:\Users\Me\.vscode\extensions\matklad.rust-analyzer-0.2.416\out\src\main.js, at the following line (12421) in function BaseLanguageClient.handleDiagnostics:
...
// Raises an exception, probably because some of the diagnostics in params.diagnostics have an empty message string
let diagnostics = this._p2c.asDiagnostics(params.diagnostics);
...
Also, not sure if related, but devtools complain about missing file C:\Users\Me\.vscode\extensions\matklad.rust-analyzer-0.2.416\language-configuration.json.
Deinstalling and reinstalling the extension using VSCode does not solve the issue.