Skip to content

Reindent & Reformat Lines stopped working in Quarto Callout Blocks #14640

Closed

Description

@cy-james-lee

Verify fixed in:

  • Patch: 2024.04.2
  • Release: 2024.07.0

System details

RStudio Edition : Desktop
RStudio Version : 2024.04.0 Build 735
OS Version      : Windows 10 x64 (build 19045)
R Version       : 4.4.0 (2024-04-24 ucrt)

Steps to reproduce the problem

  1. Open/create a quarto document.
  2. Create a Callout Block
  3. Create a code block inside the callout block and write any multi-line code (that should have indentations).
  4. Select all lines in the code block and perform Reindent Lines (Ctrl + I).

Describe the problem in detail

All lines are moved to the left end, without any indentation.

::: {.callout-note collapse="true"}
```{r}
library(dplyr)
mtcars |> 
mutate(
mpg = seq_len(
n()
)
)
```
:::

Describe the behavior you expected

Normal Reindent Lines (Ctrl + I) behavior is this:

```{r}
library(dplyr)
mtcars |> 
  mutate(
    mpg = seq_len(
      n()
    )
  )
```
  • 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 May 2, 2024
  2. ronblum commented on May 2, 2024

    @ronblum
    Contributor

    @cy-james-lee Thank you for raising the issue! I can reproduce this in RStudio Desktop 2024.04.1+735 on Windows 11.

    Note: This is source mode only--it works in visual mode. Also, this works correctly in version 2023.12.1+402.

  3. added and removed
    new
    on May 2, 2024
  4. petzi53 commented on May 3, 2024

    @petzi53

    I experienced the same problem in source mode on macOS. In my case, it didn't work inside and outside Quarto blocks.

    RStudio Edition : Desktop
    RStudio Version : 2024.04.0+735
    OS Version : MacOS Sonoma 14.4.1
    R Version : 4.4.0 (2024-04-24) -- "Puppy Cup"
    Quarto Version: 1.4.554

    Indentation works with the previous RStudio Version 2023.12.1+402, but only with 2 spaces. The older version didn't respect changes (even after restarting RStudio) in the global and project configuration. (I didn't notice this before).

    In visual mode, everything works in the older and the latest RStudio version.

  5. cy-james-lee commented on May 3, 2024

    @cy-james-lee
    Author

    I also noticed that collapsing code section doesn't work inside of callout blocks.

    I always add session info at the end of Quarto inside of a collapsed callout like so:

    ::: {.callout-note collapse="true"}
    ## Session Info
    ```{r}
    sessionInfo()
    ```
    :::
    

    I don't have the collapse button next to ## Session Info:
    image

    If I comment out the callout block enclosure, I get the collapse button back.
    image

  6. ronblum commented on May 3, 2024

    @ronblum
    Contributor

    @petzi53 Can you provide a brief example of code in which you're seeing the issue?

    @cy-james-lee I believe that what you're seeing is discussed in issue #14642.

  7. added this to the Cranberry Hibiscus milestone on May 6, 2024
  8. changed the title [-]Reindent Lines stopped working in Quarto Callout Blocks[/-] [+]Reindent & Reformat Lines stopped working in Quarto Callout Blocks[/+] on May 8, 2024
  9. ronblum commented on May 8, 2024

    @ronblum
    Contributor

    Also @d-morrison found that this happens with reformatting (cmd-shift-A or Menu Bar > Code > Reformat Code).

  10. self-assigned this
    on May 8, 2024
  11. gtritchie commented on May 9, 2024

    @gtritchie
    Member

    Regression caused by #14558.

  12. LeenSonneveld commented on May 10, 2024

    @LeenSonneveld

    This seems to occcur (in source editor) not only after callout block, but any ::: (eg. ::: column, ::: panel-tabset

  13. ronblum commented on May 29, 2024

    @ronblum
    Contributor

    Initial example verified fixed in RStudio Desktop 2024.07.0-daily+174, but need to test a little further.

  14. self-assigned this
    on May 29, 2024
  15. ronblum commented on May 30, 2024

    @ronblum
    Contributor

    Verified in RStudio Desktop 2024.04.2+762.pro1:

    • The indentation works.
    • Indentation respects the number of space of tab width.
    • The collapse arrow is present.
  16. ronblum commented on May 30, 2024

    @ronblum
    Contributor

    Verified in 2024.07.0-daily+178.pro1 on Windows 11, as well.

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