Closed bertcornelissen closed 3 years ago
Hi. Python code completion features aren't truly able to determine signatures for data classes as their methods are generated at runtime. Therefore I assume what VSCode is doing is applying a custom rule when it sees @dataclasses.dataclass
on a class. The conclusion is that, annoyingly, there is no way to get similar completion from dataclassy, unless you can somehow edit those rules yourself (which is likely to be possible, albeit inconvenient).
(Incidentally, I believe PyCharm used to nicely support dataclassy because it simply applied a similar rule whenever it saw any decorator called dataclass
, but at some point this changed and it now checks that that name resolves to a module named dataclasses
– less hacky but less convenient for us :frowning_face:)
Hi,
Great stuff. Only one question:
Old way: from dataclasses import dataclass
@dataclass class Try: a : str b : str
p = Try()
While typing "Try(" visual code gives me: (a: str, b: str) -> None as a hint
When I am using dataclassy this is not presented.
Did I miss something or is there a simple solution.
Thanks in advance.
Bert