R-nvim/R.nvim

Randomly got an error message in the R console: `Error in exists(mname) : first argument has length > 1`

Closed this issue · 1 comments

I randomly got an error message in the R console: Error in exists(mname) : first argument has length > 1. After searching the codebase, I found this error was caused by nvim.getmethod() function. Changing exists(mname) to any(exists(mname)) should do the trick. But I am not familiar with nvimcom codebase and am not sure that mname should already be a single vector in the first place, and there are other places causing it to be a vector of length > 1.

R.nvim/nvimcom/R/misc.R

Lines 426 to 431 in 7c870c8

nvim.getmethod <- function(fname, objclass) {
mname <- paste0(fname, ".", objclass)
if (exists(mname) && is.function(get(mname)))
return(mname)
return(fname)
}

I found R-nvim/cmp-r#6 just after I submitted this issue... Looks like it has been fixed in 7c870c8. Close now.