-
Notifications
You must be signed in to change notification settings - Fork 49
Open
Labels
Description
Originally posted by @juliasilge in #754 (review):
I'm supportive of us merging this because it gives us an improvement, but I want to highlight a difference in results between very similar formatters, when you use Format Document.
If you have settings like this:
{
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff"
},
"[r]": {
"editor.defaultFormatter": "Posit.air-vscode"
},
"[quarto]": {
"editor.defaultFormatter": "quarto.quarto"
}
}And two .qmd files like this:
---
title: "Untitled"
format: html
---
```{python}
1 + 1
```
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
```{python}
from typing import Iterable
import os
def sum_even_numbers(numbers: Iterable[int]) -> int:
"""Given an iterable of integers, return the sum of all even numbers in the iterable."""
return sum(
num for num in numbers
if num % 2 == 0
)
```
Second one:
---
title: "Untitled"
format: html
---
```{r}
1 + 1
```
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
```{r}
list(foobar, foobar, foobar, foobar, foobar, foobar, foobar, foobar, foobar, foobar, foobar, foobar)
```
- Put your cursor in the
1 + 1code cell - Run Format Document
- In the R file, the other code cell will get formatted, which is what I would argue is the correct behavior
- In the Python file, the other code cell not get formatted, which I think is not right
If you run Format Document from the code cell that needs formatting, the behavior is the same for both; it does format that code cell. The command Quarto: Format Cell also works well for both files.
We can log this problem to follow up on.
vezwork