Skip to content
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

Ability to disable hint diagnostics request #3104

Closed
herberthamaral opened this issue Sep 17, 2021 · 7 comments
Closed

Ability to disable hint diagnostics request #3104

herberthamaral opened this issue Sep 17, 2021 · 7 comments

Comments

@herberthamaral
Copy link

First of all: thanks for all the work done in this project! I (we) really appreciate it!

So I've been trying to disable a very annoying "error" for some months now: a hint diagnostic that both is visually distracting (because I can't do much about it) and misleading (since it adds up to the error count):

image

I try to read a bunch of code from flycheck, lsp-mode, pyright and finally decided to start opening some issues. Looks like lsp-mode asks pyright to send hint diagnostics, so I'm wondering if we could have a way to NOT send this kind of request, just in order to not have it displayed anywhere in the editor.

I am aware of flycheck error filtering, but it is not global: it is only meant to filter errors in the error list buffer.

@yyoncho
Copy link
Member

yyoncho commented Sep 17, 2021

Before looking for other solutions, have you tried prefixing unused args with _?

@herberthamaral
Copy link
Author

Hello! Just tried, doesn't work.

@dsyzling
Copy link
Member

dsyzling commented Sep 18, 2021

Did you want to simply disable that particular warning message from the type checker? If so have you tried adding:

# type: ignore 

to the line containing the warning - this should tell pyright to ignore that particular warning, this would also work if you were using mypy.

@herberthamaral
Copy link
Author

Those are not type errors, so it doesn't ignore the diagnostic when I add # type: ignore.

@yyoncho
Copy link
Member

yyoncho commented Sep 18, 2021

@herberthamaral I tested with pyright and using _ for variable name fixes the issue.

@dsyzling
Copy link
Member

I think the intention from the pyright team appears to be that it wasn't to be displayed as a diagnostic warning but a 'syntax highlight' indicating the variable is unused. I haven't checked any further on what supplemental information they may be supplying to indicate that distinction:
microsoft/pyright#1118

@herberthamaral
Copy link
Author

emacs-lsp/lsp-pyright#39 (comment) > This solved the problem for me. However I suspect it is not enough for every scenario. I'm closing this for now. Thanks, everybody!

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

No branches or pull requests

3 participants