Type hinting/code completion


I'm a pretty big PHPStorm user, and one of its best features is its robust support of phpDoc when using code completion. I'm having a lot of trouble getting the same level of support in pycharm however. To be honest, I can't get it to work at all for the most part.

Lets say I have the following code:

class Dispatcher(object):

     """ :ivar bot.commands.OperatorEventRegistry registry:
     registry = None

     """ :ivar bot.protocol.BotProtoco:
     protcol = None

     def __init__(self, protcol, registry):
          :param bot.commands.OperatorEventRegistry registry:
          :param bot.protcol.BotProtocol protcol:
          self.registry = registry
          self.protcol = protcol

The docblock given does not seem to work. I get no code completion when I use self.protocol or self.registry in other methods - there are no methods shown for bot.protocol.BotProtcol nor OperatorEventRegistry.

What exactly is the syntax for getting this to work?

Comment actions Permalink

Please try removing the trailing colons after the parameter names. I don't think they are required by anything,

Comment actions Permalink

I removed the trailing colons and now one of the variables (Request) autocompletes, but not the other. And thats only in local scope - self.request still has no autocompletion, even with an :ivar annotation.


Please sign in to leave a comment.