rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
14.08k stars 1.57k forks source link

"Expected semicolon" diagnostic should offer quickfix #4503

Open kjeremy opened 4 years ago

bnjjj commented 4 years ago

Oh yes !

bnjjj commented 4 years ago

Will try to resolve this one :)

bnjjj commented 4 years ago

In fact it's already available. But not in a very usable way. The quickfix only appears when you put your cursor where the semicolon is expected. Example : let t = index<|>. In fact it underline all the index word but the quickfix only appear at a specific place which is not great.

As I don't really know quickfix my question is how can we handle this case ? I would like to catch this message from cargo check and then map text range for quickfix to another one which is the same than the one to underline error. But is it the best to do ? Maybe we should update directly from rustc ? Any idea/suggestion @matklad ?

mieubrisse commented 3 years ago

Huge +1 to this - I'm getting an "Expected SEMICOLON" that has me completely mystified:

Screen Shot 2021-02-09 at 12 10 46 PM

EDIT: It seems to be something with the return Err(.... because if I comment out that statement then the "expected SEMICOLON" error goes away. No idea at all why rust-analyzer finds that objectionable

EDIT2: I quit and restarted Visual Studio and the error disappeared 😬 Very, very strange

EDIT3: This seems to be the issue of https://github.com/rust-analyzer/rust-analyzer/issues/4829