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

Missing hint severity for diagnostics #840

Closed
simonmandlik opened this issue Nov 1, 2024 · 5 comments
Closed

Missing hint severity for diagnostics #840

simonmandlik opened this issue Nov 1, 2024 · 5 comments
Labels
awaiting response waiting for more info from the author - will eventually close if they don't respond language server

Comments

@simonmandlik
Copy link

I'm using basedpyright together with neovim, planning to migrate from pyright. The only thing keeping me is the missing hint diagnostic severity. Hint severity is defined both in the MS specification and e.g. in neovim docs.

Is there any reason why it cannot be used in basedpyright?

@DetachHead
Copy link
Owner

basedpyright supports the deprecated and unnecessary diagnostic tags for some rules, just like pyright. i'm not sure what the hint diagnostic looks like but i don't think pyright uses it either. i'll look into adding support for it though

@DetachHead DetachHead added language server needs investigation awaiting verification by a maintainer that the issue is valid labels Nov 1, 2024
@simonmandlik
Copy link
Author

simonmandlik commented Nov 2, 2024

Interestingly, pyright produces Hint diagnostics for me e.g. for reportUnreachable:

image

whereas basedpyright uses Warning severity:

image

and they are configured pretty much the same way:

https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/basedpyright.lua
https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/pyright.lua

@DetachHead
Copy link
Owner

oh that's just because the default typeCheckingMode is different in basedpyright. see here and here for more info

if you want the same defaults as pyright, set typeCheckingMode to "basic" or "standard":

[tool.basedpyright]
typeCheckingMode = "standard"

@DetachHead DetachHead added awaiting response waiting for more info from the author - will eventually close if they don't respond and removed needs investigation awaiting verification by a maintainer that the issue is valid labels Nov 2, 2024
@simonmandlik
Copy link
Author

simonmandlik commented Nov 3, 2024

Ok, should have read the docs thoroughly once more. For anybody's reference, setting reportUnreachable = "unreachable" in the config also does what I would want for this special case.

The rest of my confusion comes from my lack of understanding of how diagnostic severities and tags from basedpyright are mapped to the four possible severities in neovim. But I can find my work around

Thanks for your time, feel free to reopen if there's still anything of interest here :)

@DetachHead
Copy link
Owner

no problem, your issue gave me the idea to simplify these hint diagnostics which will hopefully reduce some of the confusion people have had about them - see #845

to summarize, all diagnostics will support the same "hint" category, and for rules where it makes sense to do so, the appropriate diagnostic tag (unnecessary or deprecated) will be applied automatically when the rule is set to "hint":

[tool.basedpyright]
reportUnreachable = "hint"

the "unreachable" category will still work though for backwards compatibility, but it will be deprecated and probably removed at some point in the future.

@DetachHead DetachHead closed this as not planned Won't fix, can't repro, duplicate, stale Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting response waiting for more info from the author - will eventually close if they don't respond language server
Projects
None yet
Development

No branches or pull requests

2 participants