Nvim-R
Nvim-R copied to clipboard
strange errors when loading package from nvim.bol
I use Nvim-R for all my package development needs, but ~ 3 months ago (maybe longer), I started noticing this error popping up whenever I would load a package:
> devtools::load_all("/path/to/carpentries/sandpaper") # [history skip]
ℹ Loading sandpaper
Error in if (info == "\006\006") { : argument is of length zero
Error in if (info == "\006\006") { : argument is of length zero
In addition: Warning message:
In nvim.bol(paste0(bdir, "omnils_", p, "_", pvi), p, TRUE) :
Error while generating omni completion line for: .store (package:sandpaper, sandpaper).
warning messages from top-level task callback 'NVimComHandler'
Warning message:
In nvim.bol(paste0(bdir, "omnils_", p, "_", pvi), p, TRUE) :
Error while generating omni completion line for: GITIGNORED (package:sandpaper, sandpaper).
I'm not sure what the omni completion lines are, but maybe you might know what may be causing this. For what its worth, here are my .vimrc configurations for Nvim-R
I don't use devtools
to be able to replicate the issue, but the message means that info
has length zero. I accidentally pushed a commit that I wanted to put in a new branch... But, since it's already in the master branch, could you, please, update the plugin and do in a terminal emulator (delete all files cached by Nvim-R):
rm ~/.cache/Nvim-R/*
Please, fix the path ~/.cache/Nvim-R/
if necessary. Then, check if omni completion works...
I've removed all of the files from the cache, but I still get the same error.
I think the issue may be functions delayed assignment of values. For example, the first error refers to the .store
list of functions that is generated from a function. This is what the corresponding line in the omnil file looks like:
.store[listsandpaper4
The GITIGNORED
variable is dynamically loaded via delayedAssign()
when the package is loaded and doesn't make it to the omnils file.
I have installed devtools
and tried to replicate the issue, but sandpaper
depends on another package that isn't on CRAN. Do you have a simpler example?
I've created a small example that demonstrates both the function factory and delayed assign variable in https://github.com/zkamvar/znktest
> devtools::load_all("/home/zhian/Documents/Git/znktest") # [history skip]
ℹ Loading znktest
Error in if (info == "\006\006") { : argument is of length zero
Error in if (info == "\006\006") { : argument is of length zero
In addition: Warning message:
In nvim.bol(paste0(bdir, "omnils_", p, "_", pvi), p, TRUE) :
Error while generating omni completion line for: .store (package:znktest, znktest).
warning messages from top-level task callback 'NVimComHandler'
Warning message:
In nvim.bol(paste0(bdir, "omnils_", p, "_", pvi), p, TRUE) :
Error while generating omni completion line for: LOAD_TIME (package:znktest, znktest).
I get the warning message:
Error building omnils_ file. Run :RDebugInfo for details.
And :RDebugInfo
gives:
Error: $ operator is invalid for atomic vectors
In addition: Warning message:
In utils::packageDescription(p) : no package 'znktest' was found
Execution halted
After manually installing the znktest
package and restarting Neovim and R, I no longer get any error message after devtools::load_all("/tmp/znktest")
, but omni completion does not work for znktest
functions, such as set_this_lesson
. And the package appears as not having any function in the Object Browser.
If it helps: my usage pattern is:
-
vim R/zzz.R
-
<leader>rf
-
devtools::load_all()
If the package has not previously been loaded or NVim-R has been updated, then I get the error I showed above. After that, I get [ClientServer] Error in omnils file: znktest
when I run devtools::load_all()
Is Nvim-R up to date?
I am up to date on the "stable" branch, but the same error occurs if I switch to the default branch.
The length of info
is always checked in the branch pipe_data_frame. If this issue is still relevant to you, could you try the branch, please?
I've checked it and it works for me. Thank you!