Add the app_tables.table(table_name) member

  • After typing app_tables. in the IDE, the list of valid tables is suggested by the autocompletion. The IDE can do that, because the IDE knows everything it needs to know about app_tables and the database

  • After typing app_tables. in PyCharm or ptpython or any other Python editor with autocompletion, the list of tables doesn’t show up. There is no autocompletion because there is no information about the database

Up to this point everything works as expected. It would be nice to see the list of tables, but I can live without it. My request is about what comes after the table name:

  • After typing app_tables.my_table. in the IDE, the list of members of Table appears on the autocompletion. The IDE can do that for the same reason as above.

  • After typing app_tables.my_table. in PyCharm, the list of members of Table does not appear on the autocompletion. PyCharm cannot do that for the same reason as above.

At this point I am disappointed. I would like for PyCharm to know that we are dealing with a Table object and enjoy all the goodies that come with the autocompletion.

I don’t think there is a solution for the syntax used above. If I type app_tables.my_table., any autocompletion without the knowledge of the Anvil IDE cannot know what that my_table member returns… (or maybe it can?)

My request is to allow an alternative syntax that allows autocompletion in the outside world. Something like app_tables['my_table']. or app_tables.table('my_table').

This new syntax wouldn’t look as cool as the current one, but I would be happy, when I work on PyCharm, to add a little bit of verbosity if it helps the autocompletion.


This request is duplicated of this one, but I thought I would create a new one because the reason why I am requesting the feature has no workaround.

Amoni will do that for you. It creates stub files (which most modern autocompleters will use if available) based on the content of anvil.yaml.

https://amoni.readthedocs.io/en/latest/howto/use_autocompletion.html

2 Likes