Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autocomplete not working on numpy arrays (but working on numpy.ndarray) #200

Closed
j9ac9k opened this issue Oct 3, 2018 · 4 comments
Closed

Comments

@j9ac9k
Copy link

j9ac9k commented Oct 3, 2018

Problem summary

Autocompletions not working for np.array variables

Expected

a = np.array([1, 2, 3])
a.<auto-complete should get all numpy array methods>

Environment Information

  • OS: macOS
  • Neovim version: 0.3.1

Provide a minimal init.vim with less than 50 lines (required)

set runtimepath+=~/.config/nvim/plugged/deoplete.nvim/
set runtimepath+=~/.config/nvim/plugged/deoplete-jedi/
let g:deoplete#enable_at_startup = 1

let g:python_host_prog = '/Users/ogi/.pyenv/versions/neovim2/bin/python'
let g:python3_host_prog = '/Users/ogi/.pyenv/versions/neovim3/bin/python'

call plug#begin()
Plug 'davidhalter/jedi-vim'
  Plug 'lambdalisue/vim-pyenv'

Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
  Plug 'zchee/deoplete-jedi', { 'for': 'python' }

call plug#end()

let g:jedi#completions_enabled = 0

" pyenv-jedi Allows changing of jedi versions
if jedi#init_python()
  function! s:jedi_auto_force_py_version() abort
    let g:jedi#force_py_version = pyenv#python#get_internal_major_version()
    let g:deoplete#sources#jedi#python_path = g:pyenv#python_exec
  endfunction
  augroup vim-pyenv-custom-augroup
    autocmd! *
    autocmd User vim-pyenv-activate-post   call s:jedi_auto_force_py_version()
    autocmd User vim-pyenv-deactivate-post call s:jedi_auto_force_py_version()
  augroup END
endif

call deoplete#enable_logging('DEBUG', '/tmp/deoplete.log')
call deoplete#custom#source('jedi', 'debug_enabled', 1)

Generate logfiles if appropriate

  1. export NVIM_PYTHON_LOG_FILE=/tmp/nvim-log
  2. export NVIM_PYTHON_LOG_LEVEL=DEBUG
  3. nvim -u minimal.vimrc

Then look at and attach the files /tmp/nvim-log_{PID} and
/tmp/deoplete.log here.

deoplete.log
nvim-log_py2_script.log
nvim-log_py3_rplugin.log
nvim-log_py3_script.log

Steps to reproduce the issue after starting Neovim (required)

  1. Start neovim
  2. Edit a python file
  3. Select a Python environment with numpy installed (via pyenv activate)
  4. Import numpy, assign a variable as a numpy array and attempt to access that variables methods or attributes
  5. Declaring the variables as a numpy.ndarray does resolve correctly.

Screen shot (if possible)

screen shot 2018-10-03 at 2 34 32 pm
screen shot 2018-10-03 at 2 34 25 pm

Upload the logfile(s)

deoplete.log
nvim-log_py2_script.log
nvim-log_py3_rplugin.log
nvim-log_py3_script.log

Supplemental Information

Exact issue described shown here:
davidhalter/jedi#372 (comment)

Jedi author says that numpydoc has to be installed for it to work:
davidhalter/jedi#372 (comment)

@Shougo
Copy link
Collaborator

Shougo commented Oct 3, 2018

It is not deoplete-jedi's issue.
It is jedi's issue.
Closing.

@j9ac9k
Copy link
Author

j9ac9k commented Oct 4, 2018

Not sure I agree, but I will post my fix in case anyone here comes across this issue.

I addressed this by running pip install numpydoc against the neovim3 virtualenv.

Jedi's documentation states:

In order to support the numpydoc format, you need to install the numpydoc package.

Once I did that, type completion on numpy.array worked great.

@Shougo
Copy link
Collaborator

Shougo commented Oct 4, 2018

OK. jedi uses type information from the doc.

@j9ac9k
Copy link
Author

j9ac9k commented Oct 6, 2018

I'm not sure.what the overlap between vim users and numpy/scipy/pandas users is, but I would encourage you to add numpydoc as a dependency to deoplete-jedi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants