You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have followed fully the installation steps laid out in the documentation site.
I have restarted jupyterlab.
I have read the FAQ section in the documentation site.
First off, despite what I am writing below, I want to thank Ryan and all the other contributors for making this! The extension has saved me a ton of trouble and nerves and has just been an all-round quality of life improvement! 😊
Describe the bug
I have a cell in one of my notebooks that breaks on formatting. Not sure what is going wrong yet, but I managed to get a minimal breaking example:
The key here is the if statement in combination with the deep nesting. In real life, this is of course a combination of class, function, and if/else nesting.
The bug happens upon formatting twice. Here's what the first saving produces, which matches what the black online formatter produces:
Note that the second part of the if statement is now the start of the line, beginning with a ! character. Now, if I paste this version into the black online formatter, it correctly produces the exact same output. However, both on my local JupyterLab and on saturncloud.io, I get this output on the second pass:
The second part of the if has been commented out, and I don't know where that extra unicode symbol comes from either. In Jupyter it shows up as a red dot.
In any case, this obviously changes the code significantly, so something is going wrong... Since black itself seems to be doing just fine, I'd expect this to be a downstream issue, hence I'm filing this here.
Workaround
For the time being, I just disabled formatting for the code inside the if with #fmt:off. So I'm not blocked by this, but it took me a while to spot this since my code didn't break, it "just" produced incorrect results.
Diagnostic commands
Most relevant here, both black and jupyterlab_code_formatter are up to date:
Sorry for the late reply, I haven't given this project much love, I just kinda lost steam over the years as I got increasingly burnt out, but lately I have gotten a second wind (perhaps only for a brief period...)
Oh boy this is not great.
FWIW I am in middle to a big refactor for the project (mostly due to the evolution of jupyterlab's plugin tooling), I can look into this bug after that.
Without the the refactor, the development envrionment for this plugin is just nightmare-ish to use, so that is currently trumping all tasks.
Checklist prior to opening an issue
First off, despite what I am writing below, I want to thank Ryan and all the other contributors for making this! The extension has saved me a ton of trouble and nerves and has just been an all-round quality of life improvement! 😊
Describe the bug
I have a cell in one of my notebooks that breaks on formatting. Not sure what is going wrong yet, but I managed to get a minimal breaking example:
The key here is the
if
statement in combination with the deep nesting. In real life, this is of course a combination ofclass
, function, andif/else
nesting.The bug happens upon formatting twice. Here's what the first saving produces, which matches what the black online formatter produces:
Note that the second part of the
if
statement is now the start of the line, beginning with a!
character. Now, if I paste this version into theblack
online formatter, it correctly produces the exact same output. However, both on my local JupyterLab and on saturncloud.io, I get this output on the second pass:The second part of the
if
has been commented out, and I don't know where that extra unicode symbol comes from either. In Jupyter it shows up as a red dot.In any case, this obviously changes the code significantly, so something is going wrong... Since
black
itself seems to be doing just fine, I'd expect this to be a downstream issue, hence I'm filing this here.Workaround
For the time being, I just disabled formatting for the code inside the
if
with#fmt:off
. So I'm not blocked by this, but it took me a while to spot this since my code didn't break, it "just" produced incorrect results.Diagnostic commands
Most relevant here, both
black
andjupyterlab_code_formatter
are up to date:Full diagnostics
The text was updated successfully, but these errors were encountered: