1

I have a class with @property called prop. If a make an instance bar of the class and write bar.prop. in IPython and hit Tab then code completion doesn't work.

On the other hand when I put variable var in the class and write bar.var. and hit Tab then code completion works.

Can I make code completion work with @property (I would like IPython to evaluate my property, get result and use it for suggestions)?


Here's the code:

class Foo:
    def foo(self):
        print("foo")

class Bar:
    var = Foo()

    @property
    def prop(self):
        return Foo()

bar = Bar()

And bar.var. with Tab works, bar.prop. doesn't work with Tab

Radek Micek
  • 447
  • 2
  • 9
  • 1
    This was asked recently. The `ipython` tab does not evaluate the code. – hpaulj Mar 15 '19 at 16:39
  • Similar recent questions: https://stackoverflow.com/questions/54944533/autocomplete-for-jupyter-notebook-and-ipython-console-for-classes-with-propert, https://stackoverflow.com/questions/55039499/autocomplete-with-encapsulation-of-property-decorator – hpaulj Mar 15 '19 at 16:45
  • Ok, so it seems I have to use `ipython.set_hook('complete_command', ...)` and create my own completer (I have to use `set_hook` because `set_custom_completer` seems broken according to https://github.com/ipython/ipython/issues/11272). – Radek Micek Mar 16 '19 at 13:22

0 Answers0