R-nvim / R.nvim

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

`RDSendParagraph` or `RDSendLine` error when using `radian` as R app? #125

Closed mingsu closed 2 months ago

mingsu commented 2 months ago

I can use RDSendLine to correctly send content to R console when the R code contains lines end with ",", for example:

  require(ggplot2)
  data.frame(x = 1, y = 2) |>
    ggplot(aes(x = x,
      y = y)) +
  geom_point()

Above codes gives error like:

r$> require(ggplot2)

r$> data.frame(x = 1, y = 2) |>
        ggplot(aes(x = x,))

r$>       y = y)) +
Error: unexpected ')' in "      y = y)"

r$>   geom_point()
geom_point: na.rm = FALSE
stat_identity: na.rm = FALSE
position_identity 

r$>

But below codes works

  require(ggplot2)
  data.frame(x = 1, y = 2) |>
    ggplot(aes(x = x, y = y)) +
  geom_point()

I think this is resulted by the radian autocomplete the bracket, would it be possible to fix this?

PMassicotte commented 2 months ago

I just tried your code, and it is working on my side. I am not sure what is going on. Maybe @jalvesaq can reproduce it?

jalvesaq commented 2 months ago

It works on my side if using R. I can replicate the bug with Radian as R_app, but the bug disappears with the option:

bracketed_paste = true,
jalvesaq commented 2 months ago

If bracketed_paste is required also on macOS and Windows when using radian, we can make its default value true if R_app includes the "radian" string.

mingsu commented 2 months ago

Sounds great, thank you very much.