Handling 'unused parameter' hints
See original GitHub issuePyright flags unused function parameters with a hint.
![Screen Shot 2020-10-24 at 12 11 12 PM](https://user-images.githubusercontent.com/1042866/97086601-404d2a80-15f2-11eb-9c77-1647b25cb612.png)
That is often helpful, but when you’re trying to satisfy some library’s API, you may want to include placeholders for parameters even if a function or method doesn’t actually use them. An unused argument warning can be silenced by naming a parameter _
, but that only works for one parameter. Names can be dundered (like __name__
), but that feels like a hack, and doesn’t work for keyword parameters. You could also use *arg
and **kwargs
, but is a bit less clear that having placeholders.
According to this, the Pyright language server tags unused parameter hints in some way, and the LSP client can tell Pyright that it doesn’t support this tag to prevent Pyright from sending these hints. Possibly coc-pyright could provide an option to disable unused argument hints.
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (5 by maintainers)
Fixed in https://github.com/neoclide/coc.nvim/pull/2538, upgrade to latest coc.nvim and set
diagnostic.showUnused
tofalse
.I’m caught in the middle of different opinions here, because pyright developers say this should only be a syntax highlight hint and no other visual indication should be shown. For parameters of functions that are fulfilling some API this leaves users in a bad position where they have to chose to have visual noise for irrelevant (and unavoidable) noise (having a popup and a mark in the line) or completely disabling all unused variables hinting.
So is there no way to reconcile both projects views on this one? Should I just give up? And I’m not being cynical here, I’m truly hugely thankful to both projects because they make my life so much easier, this is only a tiny nuance. I just want to avoid wasting your and my time if there will be no agreement between both projects.