Skip to content

Commit bc8dac1

Browse files
committed
update labextension to jlab 4
1 parent fb6f988 commit bc8dac1

File tree

6 files changed

+6247
-4536
lines changed

6 files changed

+6247
-4536
lines changed

.eslintrc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = {
1010
"eslint:recommended",
1111
"plugin:@typescript-eslint/eslint-recommended",
1212
"plugin:@typescript-eslint/recommended",
13-
"prettier/@typescript-eslint",
13+
"prettier",
1414
"plugin:react/recommended",
1515
],
1616
parser: "@typescript-eslint/parser",

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,5 @@ lib
3232
ipyparallel/labextension
3333
tsconfig.tsbuildinfo
3434
dask-worker-space
35+
.yarn
36+
.yarnrc.yml

lab/src/index.ts

+11-7
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ async function activate(
7878
const isLab = !!labShell;
7979
const isRetroTree = PageConfig.getOption("retroPage") == "tree";
8080

81-
const clientCodeInjector = (model: IClusterModel) => {
82-
const editor = Private.getCurrentEditor(
81+
const clientCodeInjector = async (model: IClusterModel) => {
82+
const editor = await Private.getCurrentEditor(
8383
app,
8484
notebookTracker,
8585
consoleTracker,
@@ -246,12 +246,12 @@ async function activate(
246246
// If either is not found, it bails.
247247
app.commands.addCommand(CommandIDs.injectClientCode, {
248248
label: "Inject IPython Client Connection Code",
249-
execute: () => {
249+
execute: async () => {
250250
const cluster = Private.clusterFromClick(app, sidebar.clusterManager);
251251
if (!cluster) {
252252
return;
253253
}
254-
clientCodeInjector(cluster);
254+
return await clientCodeInjector(cluster);
255255
},
256256
});
257257

@@ -413,7 +413,7 @@ namespace Private {
413413
const cursor = editor.getCursorPosition();
414414
const offset = editor.getOffsetAt(cursor);
415415
const code = getClientCode(cluster);
416-
editor.model.value.insert(offset, code);
416+
editor.model.sharedModel.updateSource(offset, offset, code);
417417
}
418418

419419
/**
@@ -460,30 +460,34 @@ rc`;
460460
* In the case of a notebook, it creates a new cell above the currently
461461
* active cell and then returns that.
462462
*/
463-
export function getCurrentEditor(
463+
export async function getCurrentEditor(
464464
app: JupyterFrontEnd,
465465
notebookTracker: INotebookTracker,
466466
consoleTracker: IConsoleTracker,
467-
): CodeEditor.IEditor | null | undefined {
467+
): Promise<CodeEditor.IEditor | null | undefined> {
468468
// Get a handle on the most relevant kernel,
469469
// whether it is attached to a notebook or a console.
470470
let current = app.shell.currentWidget;
471471
let editor: CodeEditor.IEditor | null | undefined;
472472
if (current && notebookTracker.has(current)) {
473473
NotebookActions.insertAbove((current as NotebookPanel).content);
474474
const cell = (current as NotebookPanel).content.activeCell;
475+
await cell.ready;
475476
editor = cell && cell.editor;
476477
} else if (current && consoleTracker.has(current)) {
477478
const cell = (current as ConsolePanel).console.promptCell;
479+
await cell.ready;
478480
editor = cell && cell.editor;
479481
} else if (notebookTracker.currentWidget) {
480482
const current = notebookTracker.currentWidget;
481483
NotebookActions.insertAbove(current.content);
482484
const cell = current.content.activeCell;
485+
await cell.ready;
483486
editor = cell && cell.editor;
484487
} else if (consoleTracker.currentWidget) {
485488
const current = consoleTracker.currentWidget;
486489
const cell = current.console.promptCell;
490+
await cell.ready;
487491
editor = cell && cell.editor;
488492
}
489493
return editor;

package.json

+35-35
Original file line numberDiff line numberDiff line change
@@ -48,44 +48,44 @@
4848
"watch:src": "tsc -w"
4949
},
5050
"dependencies": {
51-
"@jupyterlab/application": "^3.0.0",
52-
"@jupyterlab/apputils": "^3.0.0",
53-
"@jupyterlab/codeeditor": "^3.0.0",
54-
"@jupyterlab/console": "^3.0.0",
55-
"@jupyterlab/coreutils": "^5.0.0",
56-
"@jupyterlab/mainmenu": "^3.0.0",
57-
"@jupyterlab/nbformat": "^3.0.0",
58-
"@jupyterlab/notebook": "^3.6.3",
59-
"@jupyterlab/services": "^6.0.0",
60-
"@jupyterlab/settingregistry": "^3.6.3",
61-
"@jupyterlab/statedb": "^3.0.0",
62-
"@jupyterlab/ui-components": "^3.0.0",
63-
"@lumino/algorithm": "^1.3.3",
64-
"@lumino/coreutils": "^1.5.3",
65-
"@lumino/domutils": "^1.2.3",
66-
"@lumino/dragdrop": "^1.7.1",
67-
"@lumino/messaging": "^1.4.3",
68-
"@lumino/polling": "^1.0.4",
69-
"@lumino/signaling": "^1.4.3",
70-
"@lumino/widgets": "^1.17.0",
71-
"react": "~17.0.0",
72-
"react-dom": "~17.0.0"
51+
"@jupyterlab/application": "^4.0.5",
52+
"@jupyterlab/apputils": "^4.1.5",
53+
"@jupyterlab/codeeditor": "^4.0.5",
54+
"@jupyterlab/console": "^4.0.5",
55+
"@jupyterlab/coreutils": "^6.0.5",
56+
"@jupyterlab/mainmenu": "^4.0.5",
57+
"@jupyterlab/nbformat": "^4.0.5",
58+
"@jupyterlab/notebook": "^4.0.5",
59+
"@jupyterlab/services": "^7.0.5",
60+
"@jupyterlab/settingregistry": "^4.0.5",
61+
"@jupyterlab/statedb": "^4.0.5",
62+
"@jupyterlab/ui-components": "^4.0.5",
63+
"@lumino/algorithm": "^2.0.1",
64+
"@lumino/coreutils": "^2.1.2",
65+
"@lumino/domutils": "^2.0.1",
66+
"@lumino/dragdrop": "^2.1.3",
67+
"@lumino/messaging": "^2.0.1",
68+
"@lumino/polling": "^2.1.2",
69+
"@lumino/signaling": "^2.1.2",
70+
"@lumino/widgets": "^2.3.0",
71+
"react": "~18.2.0",
72+
"react-dom": "~18.2.0"
7373
},
7474
"devDependencies": {
75-
"@jupyterlab/builder": "^3.1.10",
76-
"@types/react": "~17.0.0",
77-
"@types/react-dom": "~17.0.0",
78-
"@typescript-eslint/eslint-plugin": "^5.59.2",
79-
"@typescript-eslint/parser": "^5.18.0",
80-
"eslint": "^8.37.0",
81-
"eslint-config-prettier": "^8.5.0",
82-
"eslint-plugin-prettier": "^4.0.0",
83-
"eslint-plugin-react": "^7.21.5",
75+
"@jupyterlab/builder": "^4.0.5",
76+
"@types/react": "~18.2.21",
77+
"@types/react-dom": "~18.2.7",
78+
"@typescript-eslint/eslint-plugin": "^6.5.0",
79+
"@typescript-eslint/parser": "^6.5.0",
80+
"eslint": "^8.48.0",
81+
"eslint-config-prettier": "^9.0.0",
82+
"eslint-plugin-prettier": "^5.0.0",
83+
"eslint-plugin-react": "^7.33.2",
8484
"npm-run-all": "^4.1.5",
85-
"prettier": "^2.1.1",
86-
"rimraf": "^3.0.2",
87-
"typescript": "~4.3.5",
88-
"yarn": "^1.22.0"
85+
"prettier": "^3.0.3",
86+
"rimraf": "^5.0.1",
87+
"typescript": "~5.2.2",
88+
"yarn": "^1.22.19"
8989
},
9090
"resolutions": {
9191
"@types/react": "~17.0.0"

pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[build-system]
22
requires = [
3-
"jupyterlab>=3.0.0,==3.*",
4-
"hatchling>=0.25"
3+
"jupyterlab==4.*",
4+
"hatchling>=0.25",
55
]
66
build-backend = "hatchling.build"
77

0 commit comments

Comments
 (0)