jalvesaq / Nvim-R

Vim plugin to work with R
GNU General Public License v2.0
968 stars 126 forks source link

Problem with roxygen commands #806

Closed Dulohan closed 9 months ago

Dulohan commented 9 months ago

I have R code containing roxygen comments containing a "\donttest" statement. Apparently nvimr has problems with this command.

Fehler in base::source(getOption("nvimcom.source.path"), ..., print.eval = print .eval, : C:/Users/.../Rsource-15800:91:3: unerwartet es Symbol 90: #' @examples 91: \donttest

The code in the file reads

' @examples

' \donttest{

so there is a "#'" comment before the donttest. Maybe this is a windows specific problem .

jranke commented 9 months ago

I can reproduce this also on Linux if I send the line containing #' \donttest{ for evaluation by R, for example by moving to that line and pressing <localleader>l. In order to evaluate R code in the example section, nvim-R has to strip the roxygen comment #'. And the remaining \donttest{ syntax is not R code, which is why R complains about an unexpected symbol. I think you should be fine if you just don't include the lines containing #' \donttest{ and #' } in the region you send to R for evaluation.

jalvesaq commented 9 months ago

Thank you for the help, @jranke !

Dulohan commented 9 months ago

Not sending the roxygen comments is obviously a possibility. But roxygen comments are standards in all CRAN Packages, and they are inside the routines. So this is quite inconvenient. I think it would be better for Nvim-R to be able to cope with correct roxygen comments.

jalvesaq commented 8 months ago

@Dulohan, your contribution is welcome. You can do a pull request implementing your suggestion in VimScript for Nvim-R or in Lua for R.nvim. Unfortunately, I can no longer spend as much time as I did in the past implementing features that I will never use. And, in my opinion, we have other missing features deserving more attention, such as a debugger adapter, better support for Quarto documents, perhaps integration with httpgd, etc. Unfortunately, I don't have time for them either.