pythoncode-completionpython-jedi

python jedi code completion of returned object


I try to get neovim use jedi to do code completion but I get strange behavior when I start code completion on returned objects. It looks like jedi can not determine the returned objects type but in some cases it can.

In case I mixed something up in my configuration I tried it with Atom and it does the exact same thing.

On the first picture I started code completion and jedi recognizes the objects type. On the second it does not but it looks like the exact same thing to me.

Maybe anyone can help or had the same issue before.

successful code completion

unsuccessful code completion


Solution

  • Type inference in Python is hard. Jedi tries its best, but sometimes is not able to infer types. This is usually due to stuff like setattr, metaclasses, caching and some other stuff that Jedi is not able to understand.

    Your example above looks like its one of the above. I see that all of the time and every time I see it, it's not a bug, it's just... well... too hard to understand.