R-nvim / R.nvim

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

Issue from LSP? #162

Closed ConYel closed 5 days ago

ConYel commented 5 days ago

Hello and thank you for this great plugin. everytime I start nvim with an Rmd or R file in the lisp log I get this:

[START][2024-06-28 09:41:39] LSP logging initiated
[ERROR][2024-06-28 09:41:39] .../vim/lsp/rpc.lua:770    "rpc"   "r-languageserver"  "stderr"    "Loading required package: colorout\n"
[START][2024-06-28 09:51:47] LSP logging initiated
[ERROR][2024-06-28 09:51:47] .../vim/lsp/rpc.lua:770    "rpc"   "r-languageserver"  "stderr"    "Loading required package: colorout\n"
[ERROR][2024-06-28 10:36:27] .../vim/lsp/rpc.lua:770    "rpc"   "r-languageserver"  "stderr"    "Registered S3 methods overwritten by 'ggpp':\n  method                  from   \n  heightDetails.titleGrob ggplot2\n  widthDetails.titleGrob  ggplot2\n"
[ERROR][2024-06-28 10:38:22] .../vim/lsp/rpc.lua:770    "rpc"   "r-languageserver"  "stderr"    "\n"
[ERROR][2024-06-28 10:38:23] .../vim/lsp/rpc.lua:770    "rpc"   "r-languageserver"  "stderr"    "Setting options('download.file.method.GEOquery'='auto')\nSetting options('GEOquery.inmemory.gpl'=FALSE)\n"
[ERROR][2024-06-28 10:38:26] .../vim/lsp/rpc.lua:770    "rpc"   "r-languageserver"  "stderr"    "\n"
[START][2024-06-28 10:48:34] LSP logging initiated
[ERROR][2024-06-28 10:48:34] .../vim/lsp/rpc.lua:770    "rpc"   "r-languageserver"  "stderr"    "Loading required package: colorout\n"
[ERROR][2024-06-28 10:48:56] .../vim/lsp/rpc.lua:770    "rpc"   "r-languageserver"  "stderr"    "Registered S3 methods overwritten by 'ggpp':\n  method                  from   \n  heightDetails.titleGrob ggplot2\n  widthDetails.titleGrob  ggplot2\n"

Could that be something specific to r language server, R.nvim or something unrelated?

Thank you for your time!

jalvesaq commented 5 days ago

R.nvim doesn't include a language server. The problems in your log indicate that you are loading unnecessary libraries in your ~/.Rprofile. The use of interactive() should fix the problem:

if (interactive()) {
    # Put here everything that should run only if you are using R interactively.
    # Example:
    require("colorout", quietly = TRUE)
}
ConYel commented 2 days ago

Thanks a lot! That fixed the issue! Would it be possible to have a small note regarding that in the wiki or the README?

jalvesaq commented 2 days ago

Because the problem was in the languageserver, not in R.nvim, I think Rnvim's README is not the appropriate place for a note on this. Someone may add a section on how to configure a complete IDE for R to our wiki and include a note on avoiding loading unnecessary libraries non-interactively.

I added an example of how to properly load colorout to its README.