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

jupyterlab-lsp breaks multicursor support (box-selection via [alt] + mouse dragging) #823

Closed
randolf-scholz opened this issue Aug 10, 2022 · 5 comments · Fixed by #927
Closed

Comments

@randolf-scholz
Copy link

Description

With this extension enabled multi-cursor selection via [alt]+mouse-drag ceases to work in jupyterlab.

Reproduce

  1. conda create --name demo -c conda-forge jupyterlab jupyterlab-lsp python-lsp-server
  2. conda activate demo
  3. jupyter lab
  4. Start jupyter lab and try to select multiple lines using [alt] + mouse-drag. Shouldn't work
  5. Stop jupyter lab. Disable extension jupyter-labextension disable @krassowski/jupyterlab-lsp
  6. Restart jupyter lab. multi-cursor selection via [alt] + mouse-drag should work fine.

Expected behavior

Context

  • Operating System and version: Ubuntu 22.04
  • Browser and version: Chrome 104.0.5112.79
  • JupyterLab version: 3.4.5
  • Language server and version: python-lsp-server=1.2.1, python-lsp-jsonrpc=1.0.0, jupyterlab-lsp=3.10.1, jupyter-lsp=1.5.1
Required: installed server extensions
Config dir: /home/rscholz/.jupyter

Config dir: /home/rscholz/miniconda3/envs/lsp/etc/jupyter
jupyter_lsp enabled
- Validating jupyter_lsp...
jupyter_lsp 1.5.1 OK
jupyterlab enabled
- Validating jupyterlab...
jupyterlab 3.4.5 OK
nbclassic enabled
- Validating nbclassic...
nbclassic 0.4.3 OK
notebook_shim enabled
- Validating notebook_shim...
notebook_shim OK

Config dir: /usr/local/etc/jupyter

Required: installed lab extensions
JupyterLab v3.4.5
/home/rscholz/miniconda3/envs/lsp/share/jupyter/labextensions
        jupyterlab_pygments v0.2.2 enabled OK (python, jupyterlab_pygments)
        @krassowski/jupyterlab-lsp v3.10.1 enabled OK (python, jupyterlab-lsp)
@krassowski
Copy link
Member

I believe that this is because the default key modifier for code jump is Alt. You can change the key modifier in settings:

Screenshot from 2022-08-10 22-10-51

@randolf-scholz
Copy link
Author

Thank you, that workaround solves it for now. I also found a related comment here jupyter/notebook#4761 (comment).

@krassowski
Copy link
Member

Do you have suggestions for improving the situation? It seems that both Alt and Ctrl click are used by the mutlicursor support, so that leave no way to have click to jump without introducing a conflict.

@randolf-scholz
Copy link
Author

randolf-scholz commented Aug 15, 2022

Just spitballing a few ideas:

  • [Alt] + left click currently seems to do nothing on its own, so if a check is introduced that the user isn't selecting stuff (possibly by checking mouse travel distance between button down and button release), it could be left as-is.
  • Change it to [Alt]+ middle mouse button instead of [alt] + left-click
    • Disadvantage: Jupyter currently uses middle mouse click for pasting, must make sure to not introduce another conflict
  • Change default modifier to [shift] or something else

@krassowski
Copy link
Member

Maybe it would be sufficient to ensure that instead of mousedown (/pointerdown) triggering the jump we would wait for mouseup.

Of note, CodeMirror 6 used in JupyterLab 4 has rectangularSelection.eventFilter⁠; I do not think it would solve the problem directly, but maybe it could be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants