How to improve PyCharm code completion (auto-complete)?

When you are working with a huge project, especially when it wasn't developed by you, code completion is an essential productivity tool, one that can save you many hours of searching inside source files or documentation.

As we probably all know, code completion cannot perfectly work with dynamic code but this doesn't mean that it has to work only in few cases, and more important the user should be able to write the code and the comments in such way that it will help the IDE to detect the expected type of the variable.

Now, the question is how we can help PyCharm to help us with code completion?

One first issue would be code completion for XMLRPC calls : PY-5313 - or to rephrase it: how can I write the code in such way that I will have code completion available.

Comment actions Permalink
Please understand that I don't have any fundamental objection to the idea of type hints (and actually a custom tag distributed as a separate open-source package is probably the best way that this could be supported). The fact is that most users won't have type hints in their templates, so we really want PyCharm's code insight to work as good as possible without any type hints.
Comment actions Permalink
You wrote:
"I see no point in making it possible to specify types for local variables, because you'll spend far more time describing the type than you'll save thanks to the autocompletion which will use the type declaration"

I find this is not true.  I add "assert isinstance" all the time, despite
the fact that's a run time rather than edit time change.  That way I get access
to CTRL-Q, and the nice feeling that pycharm has my back, checking spelling of method names and the like.

Yes it's "more time", but it is also "more robust".  It's worth the extra time.

Please sign in to leave a comment.