Autocompletion and indentation issues in quarto code chunks with multi-line YAML strings

When authoring a quarto document in RStudio IDE (2023.12.0 Build 369) I observed an issue with the automatic indentation feature. Specifically, when adding a YAML entry with multi-line string to a code-chunk metadata, the following R code is not indented automatically and the auto-complete is not context-sensitive anymore.

In the following R code chunk, auto-completion and indentation are not working as expected:

```{r}
#| label: simple-plot-indentation-not-working
#| fig-cap: |
#|  Figure caption string spans
#|  multiple lines.
my_dataset %>%
  ggplot(aes(x =x, y = y)) +
  geom_line()
```

For now I'm using a workaround by adding YAML keys after multi-line strings. For example, in the following code chunk auto-completion and indentation are working as expected:

```{r}
#| label: simple-plot-indentation-working
#| fig-cap: |
#|  Figure caption string spans
#|  multiple lines.
#| fig-width: 7
my_dataset %>%
  ggplot(aes(x =x, y = y)) +
  geom_line()
```

If you have a bug report or feature request to make for RStudio, the best place for it would be the GitHub repository.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.