Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

dead_code and unused* lint are annoying #252

Open
oli-obk opened this issue Apr 8, 2017 · 11 comments
Open

dead_code and unused* lint are annoying #252

oli-obk opened this issue Apr 8, 2017 · 11 comments

Comments

@oli-obk
Copy link
Contributor

oli-obk commented Apr 8, 2017

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.

@Xanewok
Copy link
Member

Xanewok commented Apr 8, 2017

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?

@nrc
Copy link
Member

nrc commented Apr 9, 2017

cc rust-lang/vscode-rust#45

@0x7CFE
Copy link

0x7CFE commented Apr 20, 2017

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.

@oli-obk
Copy link
Contributor Author

oli-obk commented Apr 20, 2017

That's a rustc issue. We need to fix it there

@nrc
Copy link
Member

nrc commented Jul 6, 2017

Warnings can now be hidden by a config option in vscode: rust.show_warnings.

@robbym
Copy link
Contributor

robbym commented Jul 7, 2017

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

@nrc
Copy link
Member

nrc commented Jul 7, 2017

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

@robbym
Copy link
Contributor

robbym commented Jul 8, 2017

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.

@nrc
Copy link
Member

nrc commented Jul 8, 2017

"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

@nrc
Copy link
Member

nrc commented Oct 30, 2017

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.

@Xanewok
Copy link
Member

Xanewok commented Mar 3, 2019

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 microsoft/vscode#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 - microsoft/language-server-protocol#500

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants