R-nvim / R.nvim

Neovim plugin to edit R files
GNU General Public License v3.0
129 stars 15 forks source link

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

Closed hongyuanjia closed 4 months ago

hongyuanjia commented 4 months ago

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.

https://github.com/R-nvim/R.nvim/blob/7c870c8717e7b45d56d72dccfbaa4654d565d1fe/nvimcom/R/misc.R#L426-L431

hongyuanjia commented 4 months ago

I found https://github.com/R-nvim/cmp-r/issues/6 just after I submitted this issue... Looks like it has been fixed in https://github.com/R-nvim/R.nvim/commit/7c870c8717e7b45d56d72dccfbaa4654d565d1fe. Close now.