gaalcaras / ncm-R

R autocompletion for Neovim and vim 8 :memo: :bar_chart: :zap:
GNU General Public License v3.0
118 stars 10 forks source link

Could not load completion data #33

Open PumpkinL opened 3 years ago

PumpkinL commented 3 years ago

I encountered the same problem https://github.com/gaalcaras/ncm-R/issues/17#issue-401641952.

The message is :

[ncmR] Could not load completion data: [Errno 20] Not a directory: 0
[ncm_r@yarp] Traceback (most recent call last):
[ncm_r@yarp]   File "/home/liuck/.vim/plugged/nvim-yarp/pythonx/yarp.py", line 63, in <module>
[ncm_r@yarp]     module_obj = importlib.import_module(module)
[ncm_r@yarp]   File "/usr/local/lang/python/3.9.4/lib/python3.9/importlib/__init__.py", line 127, in import_module
[ncm_r@yarp]     return _bootstrap._gcd_import(name[level:], package, level)
[ncm_r@yarp]   File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
[ncm_r@yarp]   File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
[ncm_r@yarp]   File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
[ncm_r@yarp]   File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
[ncm_r@yarp]   File "<frozen importlib._bootstrap_external>", line 790, in exec_module
[ncm_r@yarp]   File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
[ncm_r@yarp]   File "/home/liuck/.vim/plugged/ncm-R/pythonx/ncm_r.py", line 303, in <module>
[ncm_r@yarp]     SOURCE = Source(vim)
[ncm_r@yarp]   File "/home/liuck/.vim/plugged/ncm-R/pythonx/ncm_r.py", line 37, in __init__
[ncm_r@yarp]     self.get_all_pkg_matches()
[ncm_r@yarp]   File "/home/liuck/.vim/plugged/ncm-R/pythonx/ncm_r.py", line 128, in get_all_pkg_matches
[ncm_r@yarp]     comps = [f for f in listdir(cmp) if 'omnils' in f]
[ncm_r@yarp] NotADirectoryError: [Errno 20] Not a directory: 0
[ncm_r@yarp] Job is dead. cmd=['python3', '-u', '/home/liuck/.vim/plugged/nvim-yarp/pythonx/yarp.py', '/tmp/vZP3jDS/2', 4, 'ncm_r']

But the completion of Omni in Nvim-R working successfully when I type \<C-x>\<C-o>

I also checked the R_compldir: ls

descr_base_4.0.5       descr_methods_4.0.5  fun_base_4.0.5       fun_methods_4.0.5  last_default_libnames  omnils_graphics_4.0.5   omnils_stats_4.0.5 descr_graphics_4.0.5   descr_stats_4.0.5    fun_graphics_4.0.5   fun_stats_4.0.5    nvimcom_info           omnils_grDevices_4.0.5  omnils_utils_4.0.5 descr_grDevices_4.0.5  descr_utils_4.0.5    fun_grDevices_4.0.5  fun_utils_4.0.5    omnils_base_4.0.5      omnils_methods_4.0.5    README

Here is my .vimrc file.

" vim plugs -----------------------------------------
call plug#begin('~/.vim/plugged')
    Plug 'roxma/vim-hug-neovim-rpc'            " support for neovim
    " completion framework ----------------------------
    Plug 'ncm2/ncm2'                           " completion framework
    Plug 'roxma/nvim-yarp'                     " Remote Plugin 
    " python support ----------------------------------
    Plug 'ncm2/ncm2-jedi'
    " R support ---------------------------------------
    Plug 'jalvesaq/Nvim-R'
    Plug 'gaalcaras/ncm-R'
call plug#end()

" ncm2 setting --------------------------------------------
" enable ncm2 for all buffers
autocmd BufEnter * call ncm2#enable_for_buffer()
" IMPORTANT: :help Ncm2PopupOpen for more information
set completeopt=noinsert,menuone,noselect
joiharalds commented 3 years ago

I also encountered this problem after a long overdue update to my neovim plugins and will leave this here as information for others.

I looked into the version history of Nvim-R and in commit 467768ee03be66e4db89b7dd1b34cd91f0689d38 from the 15th of June 2020 the git log says

Remove reference to ncm-R It seems that ncm2 and ncm-R are no longer being developed.

So it looks like ncm-r has been abandoned and the ncm2 plugin too. The Nvim-R devs then removed support for ncm-r in commit 76a8d661acaa4b74c1b74103f7de5f6a729b3333 from the 29th of April 2021. The lines

" For compatibility with ncm-R: let g:rplugin_compldir = g:rplugin.compldir

were removed from the setcompldir.vim file. This affects the ncm_r.py file but could be easily fixed by changing _ into .

In the same commit of Nvim-r the file system structure of the generated omnicompletion files (default folder: ~/.cache/Nvim-R/) changed. There is no longer a specific folder, /Nvim-R/pack_descriptions/, for description files for R packages but instead the description files are in the /Nvim-R/ folder and have prefix descr_. This would also need to be fixed in the ncm_r.py file.

There are probably other fixes needed in order to get ncm-r working again but since ncm2 seems to also be abandoned it's probably smartest to just use alternatives to ncm2 and ncm-r. For now I'll just use the autocompletion that comes with Nvim-r, initiated with the key presses c-x c-o. If anyone has suggestions for comparable alternatives please send me a message.

PumpkinL commented 3 years ago

@joiharalds Thank you very much. I use coc.nvim instead.

ryan-heslin commented 3 years ago

@joiharalds Thanks so much for explaining this. I've been trying to chase down the cause of this issue for a month, and this finally solves the mystery. It seems like YouCompleteMe is a good alternative, since it's being actively developed and supports R, though it dowsn't officially support neovim.