jupyterlab-lsp
jupyterlab-lsp copied to clipboard
jupyterlab-lsp breaks multicursor support (box-selection via [alt] + mouse dragging)
Description
With this extension enabled multi-cursor selection via [alt]+mouse-drag ceases to work in jupyterlab.
Reproduce
conda create --name demo -c conda-forge jupyterlab jupyterlab-lsp python-lsp-serverconda activate demojupyter lab- Start
jupyter laband try to select multiple lines using [alt] + mouse-drag. Shouldn't work - Stop jupyter lab. Disable extension
jupyter-labextension disable @krassowski/jupyterlab-lsp - 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/.jupyterConfig 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)
I believe that this is because the default key modifier for code jump is Alt. You can change the key modifier in settings:

Thank you, that workaround solves it for now. I also found a related comment here https://github.com/jupyter/notebook/issues/4761#issuecomment-1123067209.
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.
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
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.