I know this is a specific case.
I am building functions inside a Rmarkdown document, which builds chunks.
I remarked that, as soon as there is 3 backticks in my code, the VSCode document outline is not displayed.
Here is a reprex.
With this code, there is no outline available in VSCode, near the Rmd name
#' Create R code chunk content
#' @return A character string of R code chunk content
#' @noRd
create_r_chunk <- function() {
paste(
"```{r}",
"```",
sep = "\n"
)
}
cat(create_r_chunk())
As soon as I remove the paste with backticks, the outline is correct:
![image](https://github.com/REditorSupport/languageserver/assets/21193866/f9067773-5375-4b9e-88cb-545a8e7d324e)
````markdown
---
title: "test vscode"
output: html_document
author: statnmap
---
```{r development, include=FALSE}
library(testthat)
combine_tbl_to_file
#' Create R code chunk content
#' @return A character string of R code chunk content
#' @noRd
create_r_chunk <- function() {
paste(
"",
sep = "\n"
)
}
cat(create_r_chunk())
Maybe the parsing you use to detect chunks can be a little more restrictive, and only considering chunks when there is nothing or spaces before the backticks ?
You could maybe use patterns used by {knitr}:
I know this is a specific case. I am building functions inside a Rmarkdown document, which builds chunks.
I remarked that, as soon as there is 3 backticks in my code, the VSCode document outline is not displayed.
Here is a reprex. With this code, there is no outline available in VSCode, near the Rmd name![image](https://github.com/REditorSupport/languageserver/assets/21193866/ba532c18-14ed-4ac2-9eda-bdb943f855a2)
combine_tbl_to_file
combine_tbl_to_file
r$> knitr:::allpatterns$md $chunk.begin [1] "^[\t >]```+\s\{([a-zA-Z0-9]+( [ ,].)?)\}\s*$"
$chunk.end [1] "^[\t >]```+\s$"
$ref.chunk [1] "^\s<<(.+)>>\s$"
$inline.code [1] "(?<!(^
))(?<!(\n
))r[ #]([^
]+)\s*`"