Open TheAfroOfDoom opened 2 years ago
Same here, when I go to the code of lets say MyModel.objects.first()
by doing F12 on objects
it redirects me to stubs pre installed by VSCode. I don't understand why it takes those stubs as priority instead of my installed ones. Seems like an issue with an empty py.typed
in the root according to https://github.com/microsoft/pylance-release/issues/1197 but I can't confirm.
What I had to do which is also impractical, is to delete that global stubs folder and restart VSCode.
Ideally VSCode/Pylance should define a way to ignore the global stubs installed by VSCode. I don't know it it exists, I was unable to find a setting like this which made it work hence I deleted that folder.
Fields that you would expect to be easily type-inferred from their model definitions are showing up as
Unknown
.Example:
...results in
Data().timestamp
as typeUnknown
.I've tried specifying the type in what feels like a "typescript-style" after seeing
<xxx>Field[Unknown, Unknown]
like so:This successfully typed
Data().sample
asSample
, but it seems like it shouldn't be necessary based on the docs.It's entirely possible that my implementation of something is wrong/configuration is weird, but I've been unable to figure it out so far. Initially I thought that only my foreign keys weren't being typed properly, but I came to the realization that all fields were having this issue.
Apologies if this isn't the best place to put this; if this fork had a discussions section it'd probably be better there.
Environment: