grain icon indicating copy to clipboard operation
grain copied to clipboard

LSP: Unused Statements

Open spotandjake opened this issue 11 months ago • 2 comments

We currently do not highlight unused variables and modules and such, it would be benifical if we sent information about if things are used or not through the lsp so editors can let people know something isnt being used.

spotandjake avatar Jul 19 '23 03:07 spotandjake

I really like this. We would need the compiler to report these values back in a programmatic way

marcusroberts avatar Jul 20 '23 16:07 marcusroberts

After the meeting today, it sounds like this needs quite a few compiler changes as we would want to implement these as warnings, and it would get very annoying if you wanted unused vars, so we need to add support for disabling warnings somehow.

I think we should also report these through the lap separately from other warnings using the DiagnosticTag, unnecessary and the severity of Hint so it's not a warning but a hint. as given grain is compiled there is no good reason to warn about an unused var as it doesn't incur runtime cost or anything.

I think we should also look into reporting unused modules and types.

spotandjake avatar Jul 20 '23 18:07 spotandjake