quarto-dev / quarto

Quarto open-source scientific and technical publishing system
https://quarto.org
GNU Affero General Public License v3.0
315 stars 26 forks source link

formatting document in VSCode with Quarto breaks option syntax #368

Open lostmygithubaccount opened 7 months ago

lostmygithubaccount commented 7 months ago

xref: https://github.com/quarto-dev/quarto-cli/issues/8576

Bug description

I was told by @mcanouil here that I got my syntax wrong: https://github.com/quarto-dev/quarto-cli/discussions/8574#discussioncomment-8351297

I was wondering how that happened and figured it out. If you use the correct syntax and then format your document in VSCode using the Quarto extension, it adds a space. Since it's a single space in what looks like a Python comment, it's a bit hard to notice.

Steps to reproduce

Create a cell in a Quarto document that has an option comment:

```{python}
#| panel: input
ui.input_text("species", "Species:", value="Gentoo")

use keybindings or right click to format document with -> choose Quarto:

<img width="436" alt="image" src="https://github.com/quarto-dev/quarto-cli/assets/54814569/76f6126c-6b09-4cd2-beec-cee42463cdb7">

<img width="913" alt="image" src="https://github.com/quarto-dev/quarto-cli/assets/54814569/591ebe16-035a-4e3a-b191-2324190e9d5c">

click it, and a space appears!

<img width="430" alt="image" src="https://github.com/quarto-dev/quarto-cli/assets/54814569/4e9d3001-a669-4dd6-9c54-a00c3aae3ee4">

### Expected behavior

I would not expect formatting the cell w/ the Quarto extension in VSCode to create syntax errors

### Actual behavior

formatting the cell w/ the Quarto extension in VSCode creates syntax errors

### Your environment

- IDE: VSCode w/ Quarto extension
- computer: Mac

### Quarto check output

Quarto 1.4.542 [✓] Checking versions of quarto binary dependencies... Pandoc version 3.1.11: OK Dart Sass version 1.69.5: OK Deno version 1.37.2: OK [✓] Checking versions of quarto dependencies......OK [✓] Checking Quarto installation......OK Version: 1.4.542 Path: /Applications/quarto/bin

[✓] Checking tools....................OK TinyTeX: (not installed) Chromium: (not installed)

[✓] Checking LaTeX....................OK Tex: (not detected)

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK Version: 3.11.7 Path: /Users/cody/repos/pypi-analytics/venv/bin/python3 Jupyter: 5.7.1 Kernels: python3

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK Version: 4.3.2 Path: /Library/Frameworks/R.framework/Resources LibPaths:

[✓] Checking Knitr engine render......OK