Indentated comments have inconvenient behaviour with jupyter lab comment and uncomment function. Lab adds the # at the start of the line and black adds spaces to match indentation, uncommenting in lab just removes the # and the code is now floating with extra indentation.
E.g., I have a function
def fun(x):
"""function adds 1"""
x += 1
x *= 1
return x
and I comment the third line with ctrl+/
def fun(x):
"""function adds 1"""
x += 1
# x *= 1
return x
executing with black enabled will make it look like:
def fun(x):
"""function adds 1"""
x += 1
# x *= 1
return x
Then uncommenting with ctrl+/ again yields:
def fun(x):
"""function adds 1"""
x += 1
x *= 1
return x
Indentated comments have inconvenient behaviour with jupyter lab comment and uncomment function. Lab adds the # at the start of the line and black adds spaces to match indentation, uncommenting in lab just removes the # and the code is now floating with extra indentation.
E.g., I have a function
and I comment the third line with ctrl+/
executing with black enabled will make it look like:
Then uncommenting with ctrl+/ again yields:
Related: https://github.com/jupyterlab/jupyterlab/issues/6957