I am using deoplete-jedi to provide auto-completions inside Neovim. I found out that auto-completion does not work if I create an Image object instance using Image.open() method when using Pillow. But for Image instance created using Image.new() method, the auto-completion works correctly.
After a lot of debuging, I finally find out the reason. Because the Jedi package can not provide completions for Image instance created by Image.open()
method.
The below code shows the differences:
import jedisource1 = '''from PIL import Imageim = Image.new('test.jpg', (128, 128))im.'''script1 = jedi.Script(source1, 4, len('im.'), 'example1.py')print(script1.completions())source2 = '''from PIL import Imageim = Image.open('test.jpg')im.'''script2 = jedi.Script(source2, 4, len('im.'), 'example2.py')print(script2.completions())
Since the two methods both return an Image object, I do not know why the auto-completion behaves differently.
Version info
- Python: Python 3.6.8
- jedi: 0.13.3
- Pillow: 5.2.0