techrah / jupyterext-text-shortcuts

A Jupyter Lab extension for keyboard text shortcuts
MIT License
50 stars 11 forks source link

Incompatible with JupyterLab v4 #33

Open gabrielmagno opened 1 year ago

gabrielmagno commented 1 year ago

The text-shortcuts extension is not compatible with JupyterLab 4.x.x. There are mainly two reasons for that:

gabrielmagno commented 1 year ago

I made a fork, and was able to make it installable with pip and updated the code to use CodeMirror v6: https://github.com/gabrielmagno/jupyterext-text-shortcuts/

The code is ugly, since I'm not familiar with CodeMirror and TypeScript, but it seems to be working.

I'm not sure if it is replicating exactly the same behavior of the current extension. For instance, adding the text in a multi-selection is not working on my fork.

Considering that I'm uncertain about my code being good enough, I decided not to create a pull request (but if a maintainer think it is worthy for me to do it, let me know!).

Meanwhile, if anyone wants to install the extension in JupyterLab v4 using my fork, it is possible to install it with this command:

pip install git+https://github.com/gabrielmagno/jupyterext-text-shortcuts/
krassowski commented 3 months ago

One does not need to install an extension, JupyterLab has commands for inserting text built-in see https://github.com/jupyterlab/jupyterlab/issues/10114#issuecomment-821993321

gabrielmagno commented 2 months ago

Thank you very much @krassowski . Setting up a native shortcut is much more lightweight and preferred (in my opinion) than installing a dedicated extension for a relatively small feature.

But I've tested the native shortcut solution and there are at least two missing behaviors in relation to the extension:

Probably these are some small details that we can live without, but if that is possible to do with the native shortcut feature, it would be great.