Refactoring chunk extraction #345
Replies: 3 comments 4 replies
-
It doesn't work with this if I do ---
title: "Testing..."
---
First paragraph.
```{r}
x <- 1
```
Second paragraph.
```{python}
y = 10
```
End. |
Beta Was this translation helpful? Give feedback.
-
This should work with the latest push. |
Beta Was this translation helpful? Give feedback.
-
It works now, but the behavior is a bit different from the "main" branch. For example, if the Quarto document is: ---
title: "Testing..."
---
First paragraph.
```{r}
x <- 1
```
Second paragraph.
```{python}
y = 10
```
Third paragraph.
```{r}
w <- 2
z <- 3
```
End. If the cursor is on |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
https://github.com/R-nvim/R.nvim/tree/better-code-chunk-extraction
I have made a proof of concept on this branch. Basically, we can use
get_code_chunks()
to extract all chunks from the current buffer (regardless of the language).Then we can filter code chunks to only keep these with
eval:true
, of for a certain language.The
chunks_up_to_here()
is now very shortR.nvim/lua/r/send.lua
Lines 329 to 346 in fde972e
Beta Was this translation helpful? Give feedback.
All reactions