-
Notifications
You must be signed in to change notification settings - Fork 768
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
Remove suggestions to use deprecated type hints (List, Dict, Type, etc.) #6783
Comments
Pyright has a configuration option called If you want the completion suggestions to avoid suggesting these deprecated symbols, that would require some additional logic in the language server code. The language server features for pyright are maintained by the Microsoft pylance team. Could someone from the pylance team please transfer this enhancement request to the pylance-release project and triage/prioritize it as you see fit? Thanks! |
To be sure I understand, the request here is to eliminate this option from completions (and other similar types): Seems unnecessary to me. You typed in the upper case version. We provided it to you. It doesn't show up if you use lower case And the error is there in case you don't realize you shouldn't use the upper case version anymore. |
Ah, sorry, I wasn't very clear - I'd forgotten to appreciate how wide a scope there would be for "you're giving the wrong type hint"! What I mean are things like this suggestion below. I've written |
Ah, I misinterpreted what you meant. You're referring to the wording of the error message. The reason the error message suggests In any case, Python 3.8 was recently EOL'ed (about a month ago), so I think it's reasonable to change the error message to refer to the lowercase version. I've made that change in the pyright code base. |
…` rather than their deprecated uppercase counterparts now that Python 3.8 is EOL'ed. This addresses microsoft/pylance-release#6783.
Is your feature request related to a problem? Please describe.
As of Python 3.9, a large number of
typing.Foo
imports are deprecated: https://docs.python.org/3/library/typing.html#deprecated-aliasesThe deprecations generally fall into two categories:
foo[x]
rather thantyping.Foo[x]
collections.abc.Foo
rather thantyping.Foo
Describe the solution you’d like
Hint text should refer to the new versions, at least in Python versions that support them. I can't find a clear statement of what Python versions are currently supported, but I suspect that no in-support Python 3 versions are incompatible with
list[str]
.For example, when I write the incorrect
type(T)
, I should be told to usetype[T]
, notType[T]
: https://github.com/microsoft/pyright/blob/d22c8004f225eeaa28bdb4a06d979eeb38171b12/packages/pyright-internal/src/localization/package.nls.en-us.json#L2078-L2081The text was updated successfully, but these errors were encountered: