Skip to content

VS Code: Problem with identifying code chunk in the presence of complex structure #521

@juliasilge

Description

@juliasilge

One of our Positron users has reported a problem with the Quarto extension identifying a code chunk in their real and complicated document: posit-dev/positron#4467

I can reproduce the problem in VS Code as well. I just spent some time simplifying the document and the problem only crops up with a pretty complicated structure. I apologize 😬 but here is what I came up with:

---
title: "Here is my great title"
format: html
engine: knitr
---

# Top level

::: {.border}
Phasellus ac neque at ligula accumsan rutrum a eget ligula.
:::

## Second level 1

::: {.border}
Nulla ac nunc imperdiet, ornare dui ut, dignissim ipsum.
:::

### Third level 1

::: {.border}
Donec dapibus dui sed tincidunt cursus.
:::

### Third level 2

::: {.border}
Duis vitae justo id risus dictum mollis.
:::

### Third level 3

::: {.border}
Integer vel odio egestas, dictum enim non, lobortis nibh.
:::

### Third level 4

::: {.border}
Nam imperdiet dolor non varius commodo.
:::

::: {.border}
Praesent id dolor vel metus scelerisque scelerisque quis sed magna.
:::

::: {.border}
Aliquam laoreet dui tincidunt mauris vestibulum faucibus.
:::

### Third level 5

::: {.border}
Nullam ut nibh ultrices nibh sollicitudin tristique eu ac dui.
:::

## Second level 2

### Third level 6

::: {.border}
Donec dapibus dui sed tincidunt cursus.
:::

::: {.border}
Curabitur ac metus non neque finibus posuere.
:::

### Third level 7

::: {.border}
Ut quis turpis at dui vestibulum interdum.
:::

### Third level 8

::: {.border}
Donec dapibus dui sed tincidunt cursus.
:::

::: {.border}
Proin ut magna imperdiet neque consequat dictum ut in massa.
:::

::: {.border}
Donec suscipit nibh sed sollicitudin scelerisque.
:::

::: {.border}
Duis at sapien non erat dictum finibus ut id turpis.
:::

## Second level 3

::: {.border}
Aliquam in risus tempus, varius leo nec, aliquet orci.
:::

::: {.border}
Curabitur viverra ipsum sit amet lorem efficitur hendrerit.
:::

::: {.border}
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
:::

::: {.border}

```{r}
1 + 1
```

:::

This all looks to be valid and straightforward Quarto syntax, if a lot of it. Almost any change you make to the document makes the cell get picked up again:

Screen.Recording.2024-08-23.at.1.18.48.PM.mov

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingvscode

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions