jupyterlab-vim icon indicating copy to clipboard operation
jupyterlab-vim copied to clipboard

Updates for Jupyterlab 4

Open ianhi opened this issue 2 years ago • 5 comments

I looks as thought jupyterlab 4 will use codemirror 6: https://github.com/jupyterlab/jupyterlab/pull/11638 which drops the built in vim.

Fortunately it looks like replit has taken over maintenance of the vim extension and has updated it for CM6: https://github.com/replit/codemirror-vim#vim-keybindings-for-cm6. We should try to implement using this new package well before release to see if any changes in jlab will be necessary for this extension to continue to work.

ianhi avatar Aug 09 '22 21:08 ianhi

I understand from replit/codemirror-vim that the new extension needs to be loaded in the CM extension configuration before all other keymaps, including the basic one. I'm looking at the new JLab 4 API architecture, but I haven't figured out yet whether it allows replacing the keymap in the EditorConfiguration in packages/codemirror/src/editorconfiguration.ts, which is eventually be fed into EditorView of createEditor in packages/codemirror/src/editor.ts. It seems like injectExtension of EditorConfiguration only appends the extension in the configuration, which (I presume) would not achieve what the CM vim extension requires.

firai avatar Aug 13 '22 16:08 firai

By the way, it seems like this upcoming JLab PR might also have a significant impact on the upgrade? https://github.com/jupyterlab/jupyterlab/pull/12554

firai avatar Aug 18 '22 12:08 firai

thanks @firai! I left a comment on that PR asking about this.

I'm looking at the new JLab 4 API architecture, but I haven't figured out yet whether it allows replacing the keymap in the EditorConfiguration in packages/codemirror/src/editorconfiguration.ts, which is eventually be fed into EditorView of createEditor in packages/codemirror/src/editor.ts. It seems like injectExtension of EditorConfiguration only appends the extension in the configuration, which (I presume) would not achieve what the CM vim extension requires.

We may need to open an issue on jlab to discuss this. Probably better to do so sooner rather than later if we are going to need changes in jlab. Unfortunately I don't think I'll have the bandwidth to think about this for the next few weeks - so if anyone wants to take the lead on pushing on this please do :)

ianhi avatar Aug 19 '22 15:08 ianhi

Thanks @ianhi! Is it worth mentioning in your comment on the JLab windowing PR that the replit/codemirror-vim keymap has to be before the others in the init in order to work, rather than just adding it to the end?

firai avatar Aug 19 '22 15:08 firai

Is it worth mentioning in your comment on the JLab windowing PR that the replit/codemirror-vim keymap has to be before the others in the init in order to work, rather than just adding it to the end?

yup definitely worthwhile. I think we ought to compile a starting list of what APIs we need that don't exist in the new API an open an issue about that.

ianhi avatar Aug 21 '22 01:08 ianhi

It seems like JLab 4 has now hit RC status. The extension migration guide is at https://jupyterlab.readthedocs.io/en/latest/extension/extension_migration.html.

firai avatar May 06 '23 17:05 firai

It seems like JLab 4 has now hit RC status. The extension migration guide is at https://jupyterlab.readthedocs.io/en/latest/extension/extension_migration.html.

I tried running the script but the extension still does not work in Jupyterlab 4.

rsvdr avatar May 18 '23 16:05 rsvdr

I tried running the script but the extension still does not work in Jupyterlab 4.

I think that that script is necessary but not sufficient. The source of the vim bindings will also need ot be updated as they no longer ship with codemirror. We will now need to get them via: https://github.com/replit/codemirror-vim#vim-keybindings-for-cm6

Finally we will likely also have to change how we interact with jupyterlab codemirror as it seems that that interface has also changed.

ianhi avatar May 18 '23 19:05 ianhi

I tried running the script but the extension still does not work in Jupyterlab 4.

I think that that script is necessary but not sufficient. The source of the vim bindings will also need ot be updated as they no longer ship with codemirror. We will now need to get them via: https://github.com/replit/codemirror-vim#vim-keybindings-for-cm6

Finally we will likely also have to change how we interact with jupyterlab codemirror as it seems that that interface has also changed.

As an avid user of the JupyterLab-Vim extension, I'm eager to contribute to its updates. Can you provide an overview of the current plan? I may be relatively new to developing JupyterLab extensions, but I've familiarized myself with the documentation. It seems we might need to reconfigure the Vim bindings to accommodate the Replit version of the CodeMirror interface. Please let me know how I can assist in this process.

OracleMachine avatar Jun 06 '23 07:06 OracleMachine

Hello,

I'm an avid user of JupyterLab-Vim too and first I thank you for your work. For now I'm using JupyterLab version 3.6.x, but it should be great to have it working on 4.x.x. If I can assist I'll be pleased let me know.

Just few words of encouragement.

vilanele avatar Jun 10 '23 11:06 vilanele

Also just chiming in to say thanks to everyone who has worked / is working on this project - I can barely function without it! Is there some place I can donate? Or if I can provide some other sort of support, please let me know.

paul-turing-ml avatar Jun 22 '23 16:06 paul-turing-ml

I got to the point that I have tried VSCode for running Jupyter notebooks. It's been a good experience so far. Easy to get vim bindings and black working in code cells. It's a pity that the vim bindings have not made it to the main Jupyter code. Thanks for this extension that has been a much appreciated asset when working in JupyterLab!

dirkroorda avatar Jul 12 '23 19:07 dirkroorda

A PR adding support for JupyterLab 4.0 is up: https://github.com/jupyterlab-contrib/jupyterlab-vim/pull/85 - please help with testing and review.

krassowski avatar Jul 30 '23 03:07 krassowski

#85 has been merged and released!

Install

python -m pip install jupyterlab_vim --upgrade in an environment with jupyterlab4 should get you working install.

Thanks

Huge thanks to @krassowski for doing the work on converting the extension!

ianhi avatar Jul 31 '23 05:07 ianhi

I'm back with JupyterLab. After a short spell of using VSS code.

dirkroorda avatar Oct 23 '23 20:10 dirkroorda