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

[vscode] Python formatter breaks comment pipe #| on code blocks #135

Open
eitsupi opened this issue Apr 12, 2023 · 3 comments
Open

[vscode] Python formatter breaks comment pipe #| on code blocks #135

eitsupi opened this issue Apr 12, 2023 · 3 comments

Comments

@eitsupi
Copy link

eitsupi commented Apr 12, 2023

Currently, running a python formatter such as black on a qmd file destroys the comment pipe.

This code block

#| echo: true
print("foo")

To

# | echo: true
print("foo")

By auto formatting.

Perhaps the Quarto extension should protect the comment pipe as follows before letting the formatter run.

# #| echo: true
print("foo")
@cderv
Copy link
Contributor

cderv commented Apr 12, 2023

Related issue and discussion in black repo: psf/black#3557

@danieltomasz
Copy link

danieltomasz commented Apr 30, 2023

The same behaviour with jupyter ipynb and autopep8, using yapf as formater doesnt change #| comments

Black developers moved the discussion here
psf/black#3668

@danieltomasz
Copy link

danieltomasz commented May 2, 2023

A quick hack to exempt #| from autoformatting when using autopep8 - disable E265 - Format block comments.

With the following config in Vscode :

    "python.formatting.autopep8Args": [
    "--ignore=E302,E265"
],

the #| is unchanged for me.

I used the recipe from here visual studio code - vscode python formatting autopep8 disable E266 - Stack Overflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants