neoclide / coc-python

Python extension for coc.nvim, fork of vscode-python
575 stars 51 forks source link

No completion for generated objects. #100

Open Teeheey opened 5 years ago

Teeheey commented 5 years ago

Hi there. First of all there is :CocInfo

## versions

vim version: NVIM v0.4.2
node version: v8.12.0
coc.nvim version: 0.0.73-0a0c6cc788
term: iTerm.app
platform: darwin

My python.jediEnabled equals True

Maybe I want too much, but I'm expecting, that this extension allows me to use completion for object, generated in my code.

Here is code example:

import numpy 
list_1 = [1,2,3]
array_1 = numpy.array(list_1)

I expect, that when I type array_1 and press . I will see methods, available for ndarray ( which is object returned by my numpy.array()

But I see nothing. Is it expected behaviour?

Please, feel free to disappoint me by simple line "this is impossible, because of.."

benyaminl commented 4 years ago

Hi there. First of all there is :CocInfo

## versions

vim version: NVIM v0.4.2
node version: v8.12.0
coc.nvim version: 0.0.73-0a0c6cc788
term: iTerm.app
platform: darwin

My python.jediEnabled equals True

Maybe I want too much, but I'm expecting, that this extension allows me to use completion for object, generated in my code.

Here is code example:

import numpy 
list_1 = [1,2,3]
array_1 = numpy.array(list_1)

I expect, that when I type array_1 and press . I will see methods, available for ndarray ( which is object returned by my numpy.array()

But I see nothing. Is it expected behaviour?

Please, feel free to disappoint me by simple line "this is impossible, because of.."

I also want to know about this, even the function autocomplete is not working. Hmm.. on vs code it's working and show the function autocomplete image

EDIT : image

It's done autocomplete after I install python-language-server (even with JD enabled). Is JD need python-language-server package from pip? Thanks

EDIT : It dissapear again. What really happend. I don't understand really. I see :CocInfo andddd

## Messages[coc.nvim] Jedi error: Traceback (most recent call last):
  File "completion.py", line 8, in <module>
[coc.nvim] Jedi error:     import platform
  File "/usr/lib64/python3.6/platform.py", line 116, in <module>
    import sys, os, re, subprocess
  File "/usr/lib64/python3.6/subprocess.py", line 136, in <module>
    import _posixsubprocess
ImportError: dynamic module does not define module export function (PyInit__posixsubprocess)

Edit :

@Teehey seems you need make the numpy installed sir. I can see the autocomplete here. I use centos 7.7 and install the python3.6-numpy and it's start autocomplete

image

kafendt commented 4 years ago

I think this is a numpy problem with jedi. As far as I know it should work when installing the numpydoc package pip install --user numpydoc

Teeheey commented 4 years ago

thanks for reposponding. @benyaminl ,ofc I have installed numpy

@kafendt, after installing numpydoc I can't reproduce the problem with steps from my issue Can u explain, how it works? I have same code here

import numpy
list_1 = [1,2,3]
array_1 = numpy.array(list_1)

and when I type array_1 and press . I can see methods. There is no problem now, but I can't understand what is under numpydoc... and have imported numpy again, not nunmpydoc

benyaminl commented 4 years ago

thanks for reposponding. @benyaminl ,ofc I have installed numpy

@kafendt, after installing numpydoc I can't reproduce the problem with steps from my issue Can u explain, how it works? I have same code here

import numpy
list_1 = [1,2,3]
array_1 = numpy.array(list_1)

and when I type array_1 and press . I can see methods. There is no problem now, but I can't understand what is under numpydoc... and have imported numpy again, not nunmpydoc

The problem could lies on the python 2 and python 3 and by default it use python3 for coc-python, see https://github.com/neoclide/coc-python/issues/104#issuecomment-540350578. Try to set it on your project sir. It will work. Run also :CocInfo