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

Indentation around comments #33

Open
esillekens opened this issue Jun 29, 2021 · 0 comments
Open

Indentation around comments #33

esillekens opened this issue Jun 29, 2021 · 0 comments

Comments

@esillekens
Copy link

esillekens commented Jun 29, 2021

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

Related: jupyterlab/jupyterlab#6957

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

1 participant