odoo-ide / pycharm-odoo-old

PyCharm plugin for Odoo
https://plugins.jetbrains.com/plugin/13499-odoo
GNU General Public License v3.0
63 stars 31 forks source link

How to use comment to hint type for variables? #39

Closed tom10271 closed 3 years ago

tom10271 commented 3 years ago

Similar to @var Product $product in PHP. If it is not supported now can we have this in the future?

mrm-david commented 3 years ago

Do you mean something like this ? https://www.python.org/dev/peps/pep-0484

EDIT: Specifically in the Type comments section

tom10271 commented 3 years ago

Yes but not sure how to use it.

# type: List[ProductProduct] hints as ProductProduct's list but the attributes show are all attributes directly marked in that class, all attributes in base class are all missing.

mrm-david commented 3 years ago

I think it's because Odoo model inheritance in odoo doesn't use straightforward class inheritance, Odoo does some low level tricks to make it work and probably the type checker (in your IDE or mypy) is confused.

tom10271 commented 3 years ago

Yeah so that I think from plugin level it might be able to hints the IDE to know more on attributes in classes

trinhanhngoc commented 3 years ago

Hi @tom10271 , @mrm-david

Please follow this issue at https://github.com/trinhanhngoc/pycharm-odoo/issues/12