posit-dev / positron

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

Execute Current Code Block Without Selection #5448

Open cordeiroitamar opened 5 hours ago

cordeiroitamar commented 5 hours ago

Hello,

I noticed a difference in behavior between Positron and RStudio regarding code execution in an "R File", which has impacted my workflow.

In RStudio, if I place the cursor anywhere within a code block (even at the end of a line with a pipe operator |>), I can execute the entire block by pressing Ctrl + Enter, without needing to manually select all the lines.

In Positron, however, when working in an "R File", if I place the cursor at the end of a line with a pipe operator and press Ctrl + Enter, I get an error

To make it work in Positron, I must manually select the entire block before pressing Ctrl + Enter.

Would it be possible to implement a behavior similar to RStudio's, where the entire block of code is executed automatically based on the cursor's position in an "R File"?

juliasilge commented 5 hours ago

Can you share some example R code where you are not seeing a statement being detected as you expect? We do expect Cmd/Ctrl+Enter to detect the current statement in an .R file and then send it to a console, so if you are observing a problem, it would be great to have some details. Thanks!