While writing new code, rls complains about unused variables and similar. But often the variable is unused, because it was just created and we plan on using it a few lines down.
I suggest to create a whitelist of lints and errors, which rls should not display inside the function in which the cursor currently is in or which was last edited.
I'm not sure about unused var lint. Other IDEs, in general, do show the warnings all the time. It shouldn't take too much time from introducing the variable to actually using it and additionally when we hide the warnings when developer is editing current function we miss the main opportunity to warn him, since I'd say most of the time he'll look at the code when he's editing it.
Maybe that should be initially opt-in?
I think in case of unused (yet) functions, it would be better to highlight only the function identifier or just the first line, not the whole function body. It looks really messy when half of the screen gets underlined.
That's a rustc issue. We need to fix it there
Warnings can now be hidden by a config option in vscode: rust.show_warnings.
Adding rust.show_warnings to my vscode settings causes RLS to panic:
thread '<unnamed>' panicked at 'assertion failed: !args.is_empty()', src/build.rs:263:8
strangely, I see this too, but only if I start with it unset. If I start with it as true, then set to false, there is no problem :-s
Ok, I got it to not panic somehow, but show_warnings is not working for some reason.
I've tried
"rust.show_warnings": false
"rust.rls": {"show_warnings": false}
"rust.rls": {"rust.show_warnings": false}
None of which seem to work. Not sure why, but I will look into it.
"rust.show_warnings": false
this should work. VSCode should give you hints when typing too. You'll need to be using the plugin from https://github.com/rust-lang-nursery/rls-vscode, not the one from the marketplace
We should probably offer something clever like, only show warnings on lines where no typing has happened in the last 1 minute, or something like that. Anyway, now that we can hide warnings, I don't think this is p-high any more.
One approach we might consider is allow the user to silence a list of diagnotic codes, which seems customizable but then again I'm not sure users will want to be as flexible (I'd like to silence E0123, then E1911, also throw some E1337 with that...).
An interesting approach that VSCode experiments with is diagnostic tags https://github.com/Microsoft/vscode/issues/51104 - IIRC the first ones are around code that's unnecessary (unused, dead) and it changes the way these are rendered, so that might be one solution to this particular problem.
LSP equivalent - https://github.com/Microsoft/language-server-protocol/issues/500
Most helpful comment
I think in case of unused (yet) functions, it would be better to highlight only the function identifier or just the first line, not the whole function body. It looks really messy when half of the screen gets underlined.