Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
6 tasks done
cy-james-lee opened this issue May 2, 2024 · 10 comments
Closed
6 tasks done

Comments

@cy-james-lee
Copy link

cy-james-lee commented May 2, 2024

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.
@cy-james-lee cy-james-lee added bug new New incoming issues, ready for initial review. labels May 2, 2024
@ronblum
Copy link
Contributor

ronblum commented May 2, 2024

@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.

@ronblum ronblum added source editor and removed new New incoming issues, ready for initial review. labels May 2, 2024
@petzi53
Copy link

petzi53 commented May 3, 2024

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.

@cy-james-lee
Copy link
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

@ronblum
Copy link
Contributor

ronblum commented May 3, 2024

@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.

@ronblum ronblum added this to the Cranberry Hibiscus milestone May 6, 2024
@ronblum ronblum changed the title Reindent Lines stopped working in Quarto Callout Blocks Reindent & Reformat Lines stopped working in Quarto Callout Blocks May 8, 2024
@ronblum
Copy link
Contributor

ronblum commented May 8, 2024

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

@gtritchie gtritchie self-assigned this May 8, 2024
@gtritchie
Copy link
Member

Regression caused by #14558.

@gtritchie gtritchie assigned kevinushey and unassigned gtritchie May 9, 2024
@LeenSonneveld
Copy link

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

@ronblum
Copy link
Contributor

ronblum commented May 29, 2024

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

@ronblum ronblum self-assigned this May 29, 2024
@ronblum
Copy link
Contributor

ronblum commented May 30, 2024

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.

@ronblum
Copy link
Contributor

ronblum commented May 30, 2024

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

@ronblum ronblum closed this as completed May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants