Skip to content

Commit 8812da6

Browse files
authored
Update codemirror-vim to 6.2.1 and jupyterlab to 4.2.0 (#146)
* 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
1 parent b0a90a9 commit 8812da6

File tree

5 files changed

+2348
-1877
lines changed

5 files changed

+2348
-1877
lines changed

package.json

+13-13
Original file line numberDiff line numberDiff line change
@@ -56,25 +56,25 @@
5656
"style/index.js"
5757
],
5858
"dependencies": {
59-
"@codemirror/state": "^6.2.1",
60-
"@codemirror/view": "^6.15.3",
61-
"@jupyterlab/application": "^4.0.3",
62-
"@jupyterlab/cells": "^4.0.3",
63-
"@jupyterlab/codemirror": "^4.0.3",
64-
"@jupyterlab/fileeditor": "^4.0.3",
65-
"@jupyterlab/notebook": "^4.0.3",
66-
"@jupyterlab/settingregistry": "^4.0.3",
59+
"@codemirror/state": "^6.4.1",
60+
"@codemirror/view": "^6.26.0",
61+
"@jupyterlab/application": "^4.2.0",
62+
"@jupyterlab/cells": "^4.2.0",
63+
"@jupyterlab/codemirror": "^4.2.0",
64+
"@jupyterlab/fileeditor": "^4.2.0",
65+
"@jupyterlab/notebook": "^4.2.0",
66+
"@jupyterlab/settingregistry": "^4.2.0",
6767
"@lumino/commands": "^2.0.1",
6868
"@lumino/coreutils": "^2.0.0",
6969
"@lumino/disposable": "^2.1.2",
70-
"@replit/codemirror-vim": "^6.0.14",
70+
"@replit/codemirror-vim": "^6.2.1",
7171
"react": "^18.2.0"
7272
},
7373
"devDependencies": {
74-
"@codemirror/language": "^6.8.0",
75-
"@codemirror/search": "^6.5.0",
76-
"@jupyterlab/builder": "^4.0.0",
77-
"@jupyterlab/codeeditor": "^4.0.3",
74+
"@codemirror/language": "^6.10.1",
75+
"@codemirror/search": "^6.5.6",
76+
"@jupyterlab/builder": "^4.2.0",
77+
"@jupyterlab/codeeditor": "^4.2.0",
7878
"@types/codemirror": "^0.0.87",
7979
"@types/json-schema": "^7.0.11",
8080
"@types/react": "^18.0.26",

pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ classifiers = [
2222
"Programming Language :: Python :: 3.11",
2323
]
2424
dependencies = [
25-
"jupyterlab>=4.1.0,<5"
25+
"jupyterlab>=4.2.0,<5"
2626
]
2727
dynamic = ["version", "description", "authors", "urls", "keywords"]
2828

@@ -67,7 +67,7 @@ version_cmd = "hatch version"
6767

6868
[tool.jupyter-releaser.hooks]
6969
before-build-npm = [
70-
"python -m pip install 'jupyterlab>=4.1.0,<5'",
70+
"python -m pip install 'jupyterlab>=4.2.0,<5'",
7171
"jlpm",
7272
"jlpm build:prod"
7373
]

src/codemirrorCommands.ts

+4
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ export class VimEditorManager {
9999
// we override `hasFocus` handler to ensure it is taken into account.
100100
const cm = getCM(view)!;
101101
cm.on('vim-mode-change', () => {
102+
if (!cm.state.vim) {
103+
throw Error('CodeMirror vim state not available');
104+
return;
105+
}
102106
editor.host.dataset.jpVimModeName = cm.state.vim.mode;
103107
});
104108
mirrorEditor.hasFocus = () => {

src/labCommands.ts

+4
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,10 @@ export function addNotebookCommands(
180180
return;
181181
}
182182
const vim = cm.state.vim;
183+
if (!vim) {
184+
console.error('CodeMirror vim state not found');
185+
return;
186+
}
183187

184188
// Get the current editor state
185189
if (

0 commit comments

Comments
 (0)