John John - 5 months ago 66
Python Question

Autocomplete blender script using jedi-vim

I recently added jedi-vim to my plug-in arsenal. It works just fine for the standard modules, but is unable to find bpy and bmesh stuff.

So in the blender console I took the output of

print(sys.path)
and added it to a vimscript function in a
.lvimrc
file, like this:

function BpyPath()
python sys.path.append('/home/john/src/blender-2.77-linux-glibcl211-x86_64/2.77/python/lib/python3.5')
...
endfunction


Now it works better. Typing
bpy.
gives me:

enter image description here

But typing
bpy.context.
still gives me: -- Omni completion (^O^N^P) Pattern not found

Versions:


  • Blender: 2.77a 64-bit linux

  • OS: Fedora 22

  • Python: 2.7.10

  • Vim: 7.4



I am not a very advanced python or vim user, so any help is appreciated.

Answer

I just realized that there's not a lot of hope, because you're already talking to a compiled (C/C++) module.

If dir(bpy.context) (in a Python shell) doesn't give you the completions that you want, Jedi will also not be able to infer this information. If dir gives you something reasonable, just create an issue in the Jedi issue tracker. It would be a bug, IMO.

I'm planning a plugin system for Jedi, to make it possible to use Jedi with such use cases as well. But this will probably take two years.