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

ncm-R does not load #1

Closed gaalcaras closed 6 years ago

gaalcaras commented 6 years ago

@jalvesaq reported he could not get ncm-R to work properly.

Thanks for your plugin! However it is not working for me. I have tried with an almost empty ~/.conf/nvim directory, with only autoload/plug.vim and init.vim, and the init.vim is:

call plug#begin('~/.cache/vim-plug')
Plug 'roxma/nvim-completion-manager'
Plug 'jalvesaq/Nvim-R', { 'for' : 'r'}
Plug 'gaalcaras/ncm-R'
call plug#end()

let mapleader = ";"
let maplocalleader = ","

When I type summ the completion menu that appears has only summary <Key> because the script already has the word "summary" typed in. Any idea of what is causing the problem?

Unfortunately, I was unable to reproduce the issue with this minimal setup. If someone's able to reproduce the bug, please let me know.

Please read: https://github.com/jalvesaq/Nvim-R/issues/257#issuecomment-350031761

adrianadermon commented 6 years ago

I have the same problem with Neovim on Windows 10 - I don't get any autocompletion suggestions from your plugin.

gaalcaras commented 6 years ago

Thank you for your feedback. Unfortunately, I won't have access to a Windows 10 machine any time soon, so I'm still unable to reproduce the issue.

Could you please answer the following questions? They'll help me to narrow down the problem.

  1. Is NCM working with other filetypes, like Python?
  2. Do you see files named omnils_{PKGNAME}_{PKGVERSION} in your g:g:rplugin_compldir directory? If not, try to generate some by loading some R packages in Nvim-R.
  3. Start nvim with NVIM_PYTHON_LOG_FILE=nvim.log NVIM_PYTHON_LOG_LEVEL=INFO nvim, start an R session with Nvim-R and type some text that should trigger completion (read.csv or summary are good test cases). Then check the contents of nvim.log_py3_cm_core. Do you get lines like word: "read.csv", func: "", pkg: , pipe: None?
adrianadermon commented 6 years ago
  1. Yes - NCM works fine with Latex and the Vimtex plugin; it also works for Ultisnips completion and path completion in R.

  2. Yes.

  3. No, I can't find any such lines.

Thanks for looking into this, let me know if there is anything else I can do to help.

gaalcaras commented 6 years ago

Okay, I was finally able to reproduce the bug on Ubuntu 16.04. Could you try out the next branch and tell me if it works on Windows 10?

For instance with vim-plug:

Plug 'gaalcaras/ncm-R', { 'branch': 'next' }

@jalvesaq, does it solve the issue for you?

jalvesaq commented 6 years ago

Unfortunately, the issue is not solved. Nvim-completion-manager works with python scripts, but nothing happens with R scripts when, for example, I slowly type writeLines after starting R.

gaalcaras commented 6 years ago

Too bad, I'll keep looking. What's your version of Python 3? I had 3.6.3 on Arch, but Ubuntu 16.04 came with 3.5.2 and that's why I couldn't reproduce the bug on my system.

Also, did you get a message in Nvim by any chance? Something like [INFO] ncm-R can't find the completion data?

jalvesaq commented 6 years ago

My Python 3 is 3.6.3 too, and the file nvim.log_py3_cm_core does not include the string ncm.

I am going to merge the branch "omni_one" now, so you will not waste your time working with the old completion functions.

jalvesaq commented 6 years ago

I am no longer setting R_LIBS_USER in my ~/.bashrc and now ncm-R is working. All R packages are now installed at ~/software/R-3.4.3/library. In my init.vim, I have:

Plug 'jalvesaq/Nvim-R'
Plug 'roxma/nvim-completion-manager'
Plug 'gaalcaras/ncm-R', { 'branch': 'next', 'for': 'r' }
gaalcaras commented 6 years ago

I'm glad it's working now! However I don't understand how this could affect ncm-R. Just curious, what was the previous value of R_LIBS_USER?

Anyway, I'll be merging next to master soon. @adrianadermon, did you have time to test it on Windows 10?

jalvesaq commented 6 years ago

The value of R_LIBS_USER was ~/.cache/R.

adrianadermon commented 6 years ago

Tried with the next branch, but it still doesn't work.

I had my R_LIBS_USER set to ~/Documents/R/win-library/3.3, so I removed it to see if that helps (default is C:/Program files/R/R-3.4.1/library), but this didn't help either. I should note that the default is in .libPaths() in both cases, so perhaps the problem could be related to windows path with spaces in it (although that doesn't ex[lain @jalvesaq's problem)?

gaalcaras commented 6 years ago

perhaps the problem could be related to windows path with spaces in it

Yes, I suspect this has to do with reading files on Windows. I've created the branch windows-fix in an attempt to fix it. Can you try it and see if it works?

adrianadermon commented 6 years ago

Doesn't work, but at least I have a new error for you. Starting R from Nvim-R works fine, as does sending lines, but when start typing something in the R script file, I get the following error in the R console:

> Error: '\l' is an unrecognized escape in character string starting ""C:/Users/adrad148/AppData/Local/Temp/NvimR-adrad148\l"

[Process exited -1073741784]
gaalcaras commented 6 years ago

I think I understand where the problem comes from.

@jalvesaq and I are trying to change how ncm-R and Nvim-R communicate with each other. I believe this particular bug should disappear after I reimplement how ncm-R gets loaded R packages. See: https://github.com/jalvesaq/Nvim-R/issues/257#issuecomment-352260210. I'll get back to you when this is done and working on Linux.

I'm not sure it will solve every bug on Windows though, but we're getting there!

gaalcaras commented 6 years ago

@adrianadermon It seems from #4 that the next version of ncm-R works on Windows. If you want to give it a try, please use the following branches (this is using vim-plug):

Plug 'jalvesaq/Nvim-R', { 'branch': 'auto_list' }
Plug 'gaalcaras/ncm-R', { 'branch': 'auto-list' }

Update: both plugins have been updated, so you can stay on master and update them.

adrianadermon commented 6 years ago

It works!

I do get the following error when I type the first letter in insert mode:

[ERROR] [ncm-R] Could not load completion data: 'charmap' codec can't decode byte 0x9d in position 60: character maps to <undefined>

...but then everything seems to work fine.

gaalcaras commented 6 years ago

Great! Thanks for the feedback.

I may have an idea about that weird message, I'll try and fix that soon.