Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension migration for JupyterLab 2.x #115

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# History

## 0.12.0 / 2020-03-06

* Support JupyterLab 2.0.0+

## 0.11.0 / 2019-07-13

* Support JupyterLab 1.0.0+
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Three editing modes now exist: Jupyter command, Vim command, and Vim insert.
## Install
### Prerequisites

* JupyterLab 1.0
* JupyterLab 2.0

### Install or upgrade

Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jupyterlab_vim",
"version": "0.11.0",
"version": "0.12.0",
"description": "Code cell vim bindings",
"author": "Jacques Kvam",
"license": "MIT",
Expand Down Expand Up @@ -34,14 +34,14 @@
"extension": true
},
"dependencies": {
"@jupyterlab/application": "^1.0.1",
"@jupyterlab/codemirror": "^1.0.1",
"@jupyterlab/cells": "^1.0.1",
"@jupyterlab/notebook": "^1.0.1",
"@phosphor/commands": "^1.6.3",
"@phosphor/coreutils": "^1.3.1",
"@phosphor/domutils": "^1.1.3",
"@types/codemirror": "^0.0.76"
"@jupyterlab/application": "^2.0.1",
"@jupyterlab/codemirror": "^2.0.1",
"@jupyterlab/cells": "^2.0.1",
"@jupyterlab/notebook": "^2.0.1",
"@lumino/commands": "^1.10.1",
"@lumino/coreutils": "^1.4.2",
"@lumino/domutils": "^1.1.7",
"@types/codemirror": "^0.0.87"
},
"devDependencies": {
"rimraf": "^2.6.2",
Expand Down
16 changes: 9 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ import {
} from '@jupyterlab/codemirror';

import {
ReadonlyJSONObject
} from '@phosphor/coreutils';
ReadonlyPartialJSONObject
} from '@lumino/coreutils';

import {
ElementExt
} from '@phosphor/domutils';
} from '@lumino/domutils';

import '../style/index.css';
// Previously the vim keymap was loaded by JupyterLab, but now
Expand Down Expand Up @@ -118,7 +118,9 @@ class VimCell {
// var currentCell = ns.notebook.get_selected_cell();
// var currentCell = tracker.activeCell;
// var key = '';
if (currentCell.model.type === 'markdown') {
// `currentCell !== null should not be needed since `activeCell`
// is already check against null (row 61). Added to avoid warning.
if (currentCell !== null && currentCell.model.type === 'markdown') {
(currentCell as MarkdownCell).rendered = true;
// currentCell.execute();
}
Expand Down Expand Up @@ -193,7 +195,7 @@ function activateCellVim(app: JupyterFrontEnd, tracker: INotebookTracker): Promi

Promise.all([app.restored]).then(([args]) => {
const { commands, shell } = app;
function getCurrent(args: ReadonlyJSONObject): NotebookPanel | null {
function getCurrent(args: ReadonlyPartialJSONObject): NotebookPanel | null {
const widget = tracker.currentWidget;
const activate = args['activate'] !== false;

Expand All @@ -215,7 +217,7 @@ function activateCellVim(app: JupyterFrontEnd, tracker: INotebookTracker): Promi

if (current) {
const { context, content } = current;
NotebookActions.runAndAdvance(content, context.session);
NotebookActions.runAndAdvance(content, context.sessionContext);
current.content.mode = 'edit';
}
},
Expand All @@ -228,7 +230,7 @@ function activateCellVim(app: JupyterFrontEnd, tracker: INotebookTracker): Promi

if (current) {
const { context, content } = current;
NotebookActions.run(content, context.session);
NotebookActions.run(content, context.sessionContext);
current.content.mode = 'edit';
}
},
Expand Down
Loading