posit-dev / positron

Positron, a next-generation data science IDE
https://positron.posit.co
Other
2.82k stars 90 forks source link

Improve statement range provider in roxygen comments #5423

Open juliasilge opened 2 days ago

juliasilge commented 2 days ago

I am not sure if here is the best place to comment, but I noticed a small bug with the roxygen annotations, when issuing ctrl+enter to run the next expression. Only in particular cases, such as when the roxygen annotation is not the first comment in a given section, it works as expected (or as I am used to from RStudio), otherwise, each roxygen annotation line is sent to the console line by line. Please see the screencast that shows what I mean.

I didn't know about plumber annotations, but they work fine, I might just use them from now on... It is actually a minor bug that I am not sure I should open a new issue for it. Should I?

https://github.com/user-attachments/assets/3b59cc81-9250-49ff-bccb-e66efc8d18da

Code for reprex ```r # Running`workbench.action.positronConsole.executeCode` via `Ctrl+Enter` (x <- 0) # normal comments are skipped (x <- x+1) #* plumber annotations as well (x <- x+1) #' This is a roxygen annotation (or a comment) #' These are nice for longer comments (auto new line, highlights, etc) (x <- x+1) ## If the roxygen annotation is not the first comment in a given area, #' it works fine as well... #' This is a roxygen annotation (or a comment) #' These are nice for longer comments (auto new line, highlights, etc) (x <- x+1) ```
Positron Version / Info ``` Positron Version: 2024.12.0 build 41 Code - OSS Version: 1.93.0 Commit: 39536c265d6828a68291984d0d359170316d055e Date: 2024-11-18T02:42:16.243Z Electron: 30.4.0 Chromium: 124.0.6367.243 Node.js: 20.15.1 V8: 12.4.254.20-electron.0 OS: Linux x64 6.11.9-amd64 ```

Originally posted by @avila in #5367

juliasilge commented 2 days ago

If you get used to the way our statement range provider acts with regular comments, then roxygen comments other than #' @examples feel a bit weird.