Block Indentation / De-Indentation Behavior

I am used to using Tab / Shift + Tab to indent / de-indent a block of code in Jupyter Notebook. However, the behavior seems inconsistent in jupyter lab, it works fine when selecting a block of code, but if there is some code indented and I want to open the tooltip for a function, which also uses the Shift + Tab shortcut, both actions are performed at the same time, the tooltip opens and the line is de-indented. Honestly, it is starting to be very frustrating to have to re-indent the unintentionally de-indented line. I do not see any option to change this behavior, nor an option to disable the Shift + Tab shortcut to de-indent, which I would gladly disable to stay only with the Ctrl + [ shortcut. Does anyone know any configuration that I can change to fix this issue?

Just one simple example:

import numpy as np
for i in range(5):
    array = np.array(i)

Maybe I want to open the tooltip for np.array, so I put the cursor after np.array( and press Shift + Tab, which opens the tooltip, but gives me:

import numpy as np
for i in range(5):
array = np.array(i)

FIY, the behavior on the classical notebook was to only de-indent if the whole line or more than one line was selected, which for me is much more natural.

1 Like

@BrunoBelucci I believe that you are running into Jupyterlab 4.1 dedent broken · Issue #15821 · jupyterlab/jupyterlab · GitHub which was a regression introduced in 4.1.0 and fixed by Fix spurious dedent when opening inspector tooltip by krassowski · Pull Request #15898 · jupyterlab/jupyterlab · GitHub in JupyterLab v4.1.4 (the latest version is 4.1.5). Can you check your JupyterLab version, upgrade and see if it is still a problem?

1 Like

Yes, it totally solved the problem! Thank you very much, I had spent some time looking for this issue on GitHub and here on the forum but I missed this issue.

2 Likes