Skip to content

Commit

Permalink
Update codemirror-vim to 6.2.1 and jupyterlab to 4.2.0 (#146)
Browse files Browse the repository at this point in the history
* Bump CM and JL packages to match JL 4.2.0

* Bump cm-vim version

* Regenerate lock file

* Add guards for possible null value in cm.state.vim introduced by codemirror-vim
  • Loading branch information
firai authored Sep 12, 2024
1 parent b0a90a9 commit 8812da6
Show file tree
Hide file tree
Showing 5 changed files with 2,348 additions and 1,877 deletions.
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,25 @@
"style/index.js"
],
"dependencies": {
"@codemirror/state": "^6.2.1",
"@codemirror/view": "^6.15.3",
"@jupyterlab/application": "^4.0.3",
"@jupyterlab/cells": "^4.0.3",
"@jupyterlab/codemirror": "^4.0.3",
"@jupyterlab/fileeditor": "^4.0.3",
"@jupyterlab/notebook": "^4.0.3",
"@jupyterlab/settingregistry": "^4.0.3",
"@codemirror/state": "^6.4.1",
"@codemirror/view": "^6.26.0",
"@jupyterlab/application": "^4.2.0",
"@jupyterlab/cells": "^4.2.0",
"@jupyterlab/codemirror": "^4.2.0",
"@jupyterlab/fileeditor": "^4.2.0",
"@jupyterlab/notebook": "^4.2.0",
"@jupyterlab/settingregistry": "^4.2.0",
"@lumino/commands": "^2.0.1",
"@lumino/coreutils": "^2.0.0",
"@lumino/disposable": "^2.1.2",
"@replit/codemirror-vim": "^6.0.14",
"@replit/codemirror-vim": "^6.2.1",
"react": "^18.2.0"
},
"devDependencies": {
"@codemirror/language": "^6.8.0",
"@codemirror/search": "^6.5.0",
"@jupyterlab/builder": "^4.0.0",
"@jupyterlab/codeeditor": "^4.0.3",
"@codemirror/language": "^6.10.1",
"@codemirror/search": "^6.5.6",
"@jupyterlab/builder": "^4.2.0",
"@jupyterlab/codeeditor": "^4.2.0",
"@types/codemirror": "^0.0.87",
"@types/json-schema": "^7.0.11",
"@types/react": "^18.0.26",
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ classifiers = [
"Programming Language :: Python :: 3.11",
]
dependencies = [
"jupyterlab>=4.1.0,<5"
"jupyterlab>=4.2.0,<5"
]
dynamic = ["version", "description", "authors", "urls", "keywords"]

Expand Down Expand Up @@ -67,7 +67,7 @@ version_cmd = "hatch version"

[tool.jupyter-releaser.hooks]
before-build-npm = [
"python -m pip install 'jupyterlab>=4.1.0,<5'",
"python -m pip install 'jupyterlab>=4.2.0,<5'",
"jlpm",
"jlpm build:prod"
]
Expand Down
4 changes: 4 additions & 0 deletions src/codemirrorCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ export class VimEditorManager {
// we override `hasFocus` handler to ensure it is taken into account.
const cm = getCM(view)!;
cm.on('vim-mode-change', () => {
if (!cm.state.vim) {
throw Error('CodeMirror vim state not available');
return;
}
editor.host.dataset.jpVimModeName = cm.state.vim.mode;
});
mirrorEditor.hasFocus = () => {
Expand Down
4 changes: 4 additions & 0 deletions src/labCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ export function addNotebookCommands(
return;
}
const vim = cm.state.vim;
if (!vim) {
console.error('CodeMirror vim state not found');
return;
}

// Get the current editor state
if (
Expand Down
Loading

0 comments on commit 8812da6

Please sign in to comment.