bnjmnp / pysoem

Cython wrapper for the Simple Open EtherCAT Master Library
MIT License
93 stars 35 forks source link

Code completion / Intellisense not working for #145

Open RobertoRoos opened 1 week ago

RobertoRoos commented 1 week ago

I couldn't find a reference to this yet: it seems code completion / intellisense / etc. isn't working at all for pysoem: image

This is in PyCharm, but the same happens in VS Code.

I imagine this is a consequence of Cython? Maybe we could add some .pyi files for code analysis. Ideally generated from the Cython source files.

RobertoRoos commented 1 week ago

I'm a little surprised code suggestions are also not working form a console, because __dir__ looks to be implemented correctly: image

RobertoRoos commented 1 week ago

One option could be create a .pyi file in the module, alongside the .pyx file. This will describe the interface to any IDE:

# file: pysoem/pysoem.pyi

class Master: ...

def find_adapters(): ...

But this would require every single object to be repeated, which isn't very DRY. The .pyi file would be leading for documentation too, so all docs info should be moved from the source file into the interface file.

I've teste MyPy's stubgen, but it doesn't detect the contents of the pysoem package directly.