posit-dev / positron

Positron, a next-generation data science IDE
Other
1.83k stars 52 forks source link

Sections in R scripts don't appear in Outline view #3822

Open abduazizR opened 2 weeks ago

abduazizR commented 2 weeks ago

So in Rstudio, I can type ctrl+shift+R to put sections in my R script so I can track my work. Is this feature available for Positron? For R and Python?

jmcphers commented 2 weeks ago

Yes it is! Enable the RStudio keymap:

image

Then you'll get an "Insert Section" command binding to Ctrl + Shift + R:

image

It works just like RStudio's command of the same name.

There's no direct equivalent in Python, but there's something very similar for grouping code into sections; if you start a comment with #%% then Positron will recognize it as a "cell" (the same is available for R with the #+ comment).

abduazizR commented 2 weeks ago

Thanks for the response. For R, I can't see the outlines of the sections in the editor so I can navigate between them.

jmcphers commented 2 weeks ago

You're right, things like functions show up but sections don't.

image

That's something we should fix. I'm going to update the title of the issue. Thanks for reporting!

rjake commented 4 days ago

Just to highlight this request a bit further, my outlines in RStudio made heavy use of emoji and that made it very easy to navigate. I'm missing it quite a bit in Positron

```{r read-pins}
# raw data ----
## ☁ board ----
board <- board_connect()

## 📌 all_deps ----
all_deps <- pin_read(board, "my-table")
![image](https://github.com/user-attachments/assets/b1fcc919-379b-4765-9bb8-6626fa50b574)

And for anyone curious, this is my legend

🔳 = card 👀 = observe ⏺ = constant 👉 = output ⚙ = function 💫 = reactive, starts 'r_' 💲 = input widget