Skip to content

Option to disable red-underlining large blocks of code #7067

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
k-stanislawek opened this issue Dec 28, 2020 · 5 comments
Open

Option to disable red-underlining large blocks of code #7067

k-stanislawek opened this issue Dec 28, 2020 · 5 comments
Labels
A-diagnostics diagnostics / error reporting C-bug Category: bug S-actionable Someone could pick this issue up and work on it right now

Comments

@k-stanislawek
Copy link

k-stanislawek commented Dec 28, 2020

Rust analyzer tends to fill the whole function or file with red, like this:
image
This is annoying, I tend to disable the plugin for a moment when that happens.

It happens when I'm in the middle of writing a new function, or refactoring a function, and the error is "wrong return type". Sometimes I satisfy it by providing a return statement first, even mocked one, but it doesn't work if I want multiple branches with different returns.

Another use-case is when opening/closing brackets don't match, and red color makes it more difficult to find what's wrong.

@lnicola
Copy link
Member

lnicola commented Dec 28, 2020

Please post some code (a complete function, preferably) where this happens.

This is probably a rustc error. rustc sometimes outputs error spans that are too large, and there's not much we can do about it, e.g. rust-lang/rust#77968.

@lnicola lnicola added A-diagnostics diagnostics / error reporting S-unactionable Issue requires feedback, design decisions or is blocked on other work labels Dec 28, 2020
@0x8f701
Copy link

0x8f701 commented Dec 28, 2020

Is there a way to change vscode's highlight group? I removed this by doing:https://github.com/GopherJ/cfg/blob/master/coc/.vimrc#L313-L330 in vim, I only keep line number error signs

@PatchMixolydic
Copy link

Workaround: using todo!() in place of a returned value will quiet any "wrong return type" errors (since todo! panics, it "returns" !, which coerces to any type).

@lnicola
Copy link
Member

lnicola commented Jan 5, 2021

loop {} also works in a pinch.

@jonas-schievink
Copy link
Contributor

Not sure if the original report was about a rustc issue, but the new native mismatched-type diagnostic also has this issue.

@jonas-schievink jonas-schievink added S-actionable Someone could pick this issue up and work on it right now C-bug Category: bug and removed S-unactionable Issue requires feedback, design decisions or is blocked on other work labels Apr 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics diagnostics / error reporting C-bug Category: bug S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

No branches or pull requests

5 participants