Conversation
|
Support for Typst was added to |
|
My approach in this pull request was to set the filetype of a |
| return chunks | ||
| end | ||
|
|
||
| --- Get code chunks from an RTypst (.Rtyp) document by scanning ```{r} and ``` markers. |
There was a problem hiding this comment.
Can we not use
Lines 97 to 154 in 2d0cd15
I think rtyps uses the same structure?
I think
local params_str = lines[i]:match("^```{r}$")Will not capture params in r chunks, like {r echo=FALSE} or {python}
There was a problem hiding this comment.
It was easier for me to use regular expressions, but if you could rewrite the function using tree-sitter, it would be great.
|
I think we could just do that in vim.treesitter.language.register("markdown", { "quarto", "rmd", "rtyp" })Then we could just reuse What do you think? |
Yes, I think this is the right approach. |
It would not work. Typst is very different from Markdown. It uses |
This was my first thought. But then I realized that if the file is a Typst file, we can send the R code to R Console, but we will not be able to process the R code when rendering the PDF because knitr converts a |
|
I'll be able to continue working on this only at night... |
|
Note: |
fix(ftplugin): use pcall for treesitter query set to handle errors refactor(chunk.lua): remove custom RTypst code chunk parsing feat(cursor.lua): add typst support for moving to next code chunk fix(lsp/init.lua): correct iteration over attached_buffers feat(maps.lua): add typst support for RSendChunk and related mappings feat(send.lua): add typst support for sending lines and chunks
|
PS. I have not tested knitting, I do not have the dev version of |
|
I will push this, let me know if it works for you, otherwise we can just delete the commit if anything :) |
|
I am currently using Markdown parser to get the chunks code, inline params and chunks parameters, The Markdown grammar is resilient enough to work with typst filetype. I started to implement a typst specific TS extraction code, but we have to do some manually regex job to get the inline parameters in chunks like: What I have done if more a general refactor on how we get the code chunks based on the file type. At the moment, it works with just using Markdown parser, but maybe I could push the current refactor later in another PR. |
Yes, it was OK. I think you have already pushed... |
|
I'm getting this message when trying to send a line from a chunk of R code:
|
Back to the office, I will have a look. |
|
I've just found that the filetype But not if it is: |
|
I have some meetings this morning, I think I forgot to push a change yesterday. Will do that soon. |
|
There is no hurry, and I will only have spare time next weekend. |

No description provided.