AutoCompleting code - Project Variables

Answered

Hi, I was wondering if there is a good way to make all variables with a specific name's auto completion to a specific class. E.g. I have a project that uses a lot of separate functions that uses an API. I have a variable called `ctx` in all of these functions, and I would like to tell PyCharm that all of these will be of a specific class so I can use AutoComplete, instead of having to remember all the names. The only way I can find which is close is using type hinting, but this looks messy, as it's used everywhere. If there isn't a way built in, is anyone aware of a plugin that can do this? If not, I hope you'll consider adding it to a future update, where it appears in the project settings for a specific project, or global settings. Thanks.

0
1 comment

Hi Nihaal, 

Unfortunately we can suggest only type hinting or writing your own plugin (https://www.jetbrains.com/help/idea/plugin-development-guidelines.html) for it because we're not aware of any existing one. 

Also feel free to file a feature request about it to Pycharm issue tracker: https://youtrack.jetbrains.com/issues/PY.

0

Please sign in to leave a comment.