Skip to content

Chunks without code in them break Quarto syntax highlighting and outline in source editor #14544

Closed

Description

@mine-cetinkaya-rundel

System details

RStudio Edition : Desktop
RStudio Version : RStudio 2024.04.0-daily+689 "Chocolate Cosmos" Daily (9ee2b6131e42e36e31cec48a4eb88d2e700e272c, 2024-04-10) for macOS Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) RStudio/2024.04.0-daily+689 Chrome/120.0.6099.291 Electron/28.2.6 Safari/537.36, Quarto 1.4.553 (/Applications/quarto/bin/quarto)
OS Version      : Mac OS Ventura 13.5 (22G74)
R Version       : R version 4.3.3 (2024-02-29) -- "Angel Food Cake"

Steps to reproduce the problem

In a Quarto document insert some 1st and 2nd level headers and code chunks in each one. For one of the code chunks, add a chunk option but no code in it. (This comes up when that chunk option is ref-label, where you don't need to add more code, you just want to refer to an earlier chunk.)

Describe the problem in detail

The outline and the syntax highlighting for headers and chunks are broken for the remainder of the document.

For example, note the green first level header (Chapter 2) and pink curly braces for the last chunk as well as the lack of indentation for section headers in the document outline.

Screenshot 2024-04-14 at 8 56 19 AM

Things look ok in the visual editor.

Screenshot 2024-04-14 at 8 56 06 AM

Describe the behavior you expected

I expected things to look like the following even when that middle code chunk doesn't have any code in it.

Screenshot 2024-04-14 at 8 58 29 AM
  • I have read the guide for submitting good bug reports.
  • I have installed the latest version of RStudio, and confirmed that the issue still persists.
  • If I am reporting an RStudio crash, I have included a diagnostics report.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.

Activity

  1. added
    new
    on Apr 14, 2024
  2. added and removed
    new
    on Apr 16, 2024
  3. ronblum commented on Apr 16, 2024

    @ronblum
    Contributor

    Reproducible:

    • Problem occurs in RStudio Desktop 2024.04.0-daily+693 on Windows 11.
    • This is a regression, as it works in 2023.12.1+402.
    • The problem is in source mode--the document outline works correctly in visual mode.
    ---
    format: html
    ---
    
    # Chapter 1
    
    ## Section 1.1
    
    Hello
    
    ```{r}
    #| label: simple-arithmetic
    1 + 1
    ```
    
    ## Section 1.2
    
    Mello
    
    ```{r}
    #| ref-label: simple-arithmetic
    ```
    
    # Chapter 2
    
    Jello
    
    ```{r}
    3 + 3
    ```
    
  4. added this to the Chocolate Cosmos milestone on Apr 17, 2024
  5. self-assigned this
    on Apr 17, 2024
  6. ronblum commented on Apr 22, 2024

    @ronblum
    Contributor

    Verified in RStudio Desktop 2024.04.0+725 on Windows 11 using the above example and intentionally messing it up in different ways. There's a separate old issue with the outline that I'll file separately.

  7. self-assigned this
    on Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions