-
Notifications
You must be signed in to change notification settings - Fork 31
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
formatting document in VSCode with Quarto breaks option syntax #368
Comments
I'm having the same issue, it's extremely frustrating. To clarify I've a .qmd document containing both python/r blocks. The {r} blocks are formatted correctly while the {python} blocks suffer the issue that the #| have spaces inserted. |
About the formatting space, there is nothing Quarto can do about it.
And actually this issue is a duplicate of: What you can do is to add an exception to the rules being applied as for autopep8: |
@mcanouil, thanks for the swift reply. Can you clarify if it possible to select which formatter Quarto uses for the python blocks? While I can modify the preferences for autopep8 to not correct #| , I'm not sure how to force Quarto to use autopep8 rather than black for formatting. |
for what it's worth, I would still consider this a Quarto VSCode extension issue and not a as a Quarto user, it is frustrating to run into this, and especially then be told in a condescending tone by one of the maintainers:
when in fact it's the extension from Quarto that I installed that caused the issue |
Formatter configuration are detailed in their respective documentation. The formatter does not seem to be hardcoded so it likely uses the one you defined as formatter. (I am not very familiar with the Quarto extension codebase) |
I think there is some miss-understanding here which I might be in part responsible because I did not know at that time that it was Black formatting that was causing the extra space. The issue with Python Shinylive inside Quarto not recognising Edit: Quarto Shinylive not supporting
This is your interpretation of a non native speaker writing in English. This kind of comment does not help in any way addressing the initial issue or the wording issue. Important We appreciate your interest in the Quarto project, but the content above violates our Code of Conduct. As a member of the Quarto community, you are expected to follow our Code of Conduct, which outlines the standards of behavior and communication that we value. The Code of Conduct applies to all online interactions within the Quarto project, and it is enforced by the Quarto team. By participating in the Quarto community, you agree to abide by the Code of Conduct and respect the rights and dignity of others. You can find the Code of Conduct at https://github.com/quarto-dev/quarto-cli?tab=coc-ov-file#readme. Thank you for your cooperation and contribution. 🙏 |
I'll add support to shinylive for It might be too late for this, but neither black nor ruff make this kind of change to lines with two hashes, e.g. # Test with black
echo '
#| test: this
##| test: this
' | uvx black -q -
#> # | test: this
#> ##| test: this
# Test with ruff format
echo '
#| test: this
##| test: this
' | uvx ruff format -q -
#> # | test: this
#> ##| test: this |
xref: quarto-dev/quarto-cli#8576
Bug description
I was told by @mcanouil here that I got my syntax wrong: quarto-dev/quarto-cli#8574 (reply in thread)
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:
use keybindings or right click to format document with -> choose Quarto:
click it, and a space appears!
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
Quarto check output
The text was updated successfully, but these errors were encountered: