Black reindents Py:Percent/Spyder IDE comments destroying them. #1542
Labels
F: comments
The syntactic kind. Not in the language grammar, always on our minds. Best bugs.
T: bug
Something isn't working
Describe the bug A clear and concise description of what the bug is.
To Reproduce Steps to reproduce the behavior:
Full instructions for reproduce are provided here: mwouts/jupytext#562
Expected behavior A clear and concise description of what you expected to happen.
Black shouldn't reindent
# %%
blocks, but it will try to and that causes issues since it not longer represents break points for Spyder, VSCode, JuPyText or other IDEs. Splitting an if statement or function so that Spyder will no longer recognize it as such. Replacing the comments with the equivalent#%%
leads to the same behavior.I've even tried to guard these comments with
#fmt: off
and#fmt: on
but that hasn't worked. My only current workaround is to use sed find and replacements directly after black which unfortunately breaks a lot of the functionality.The tests located here do not cover this edge case unfortunately and should be updated.
Environment (please complete the following information):
Does this bug also happen on master? To answer this, you have two options:
Yes
latest master branch.
pip install -e .
;python -m unittest
; andblack
like you did last time.Additional context These features are important for JuPyText jupyter notebook scripts and currently make maintaining them more difficult.
The text was updated successfully, but these errors were encountered: