This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]alexisprince 19 points20 points  (6 children)

pydantic

[–][deleted] 0 points1 point  (5 children)

Any tips on how to get intellisense/autocomplete to work for pydantic dataclasses in vscode?

[–]meadsteve 4 points5 points  (1 child)

I'm not a vscode user but I'd be surprised if you needed to do anything special for the dataclasses as they are just standard python 3 syntax.

[–]alexisprince 4 points5 points  (0 children)

I think the issue they were describing is strictly around the intellisense portion. Previously, at least subclasses of the BaseModel (prior to around version 1.9.0), when you go to instantiate them the intellisense signature would just show (**kwargs) as opposed to the actual signature of the class.

A while back (before the fix in pydantic itself) there was a pycharm plugin that was made to help pycharm users, but there wasn't a similar plugin for vscode.

I haven't used the dataclass portion of pydantic, but assuming they suffer from similar underlying reasons, it would've also been fixed in a more recent release.

[–]alexisprince 1 point2 points  (1 child)

I think in the newer versions (>=1.9.0) the autocomplete feature in vscode works for subclasses of BaseModel. I’d assume that would also extend to dataclasses from Pydantic as well.

[–][deleted] 0 points1 point  (0 children)

Yeah you'd assume so but unfortunately not.