Skip to content

Commit 50c02f2

Browse files
committed
Enable extension settings
1 parent d3ef1ed commit 50c02f2

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,19 @@
2828
},
2929
"files": [
3030
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
31-
"style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}"
31+
"style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}",
32+
"schema/*.json"
3233
],
3334
"jupyterlab": {
34-
"extension": true
35+
"extension": true,
36+
"schemaDir": "schema"
3537
},
3638
"dependencies": {
3739
"@jupyterlab/application": "^1.0.1",
3840
"@jupyterlab/codemirror": "^1.0.1",
3941
"@jupyterlab/cells": "^1.0.1",
4042
"@jupyterlab/notebook": "^1.0.1",
43+
"@jupyterlab/coreutils": "^3.0.0",
4144
"@phosphor/commands": "^1.6.3",
4245
"@phosphor/coreutils": "^1.3.1",
4346
"@phosphor/domutils": "^1.1.3",

schema/vim.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"jupyter.lab.setting-icon-class": "jp-NotebookIcon",
3+
"jupyter.lab.setting-icon-label": "Notebook",
4+
"title": "Vim Notebook Cell",
5+
"description": "Vim Notebook Cell Settings",
6+
"properties": {
7+
},
8+
"type": "object"
9+
}

src/index.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ import {
1212
MarkdownCell
1313
} from '@jupyterlab/cells';
1414

15+
import {
16+
ISettingRegistry
17+
} from '@jupyterlab/coreutils';
18+
1519
import {
1620
CodeMirrorEditor
1721
} from '@jupyterlab/codemirror';
@@ -38,10 +42,10 @@ const IS_MAC = !!navigator.platform.match(/Mac/i);
3842
* Initialization data for the jupyterlab_vim extension.
3943
*/
4044
const extension: JupyterFrontEndPlugin<void> = {
41-
id: 'jupyterlab_vim',
45+
id: 'jupyterlab_vim:vim',
4246
autoStart: true,
4347
activate: activateCellVim,
44-
requires: [INotebookTracker]
48+
requires: [INotebookTracker, ISettingRegistry]
4549
};
4650

4751
class VimCell {
@@ -189,10 +193,11 @@ class VimCell {
189193
private _app: JupyterFrontEnd;
190194
}
191195

192-
function activateCellVim(app: JupyterFrontEnd, tracker: INotebookTracker): Promise<void> {
196+
function activateCellVim(app: JupyterFrontEnd, tracker: INotebookTracker, settingRegistry: ISettingRegistry): Promise<void> {
197+
const id = extension.id;
198+
const { commands, shell } = app;
193199

194-
Promise.all([app.restored]).then(([args]) => {
195-
const { commands, shell } = app;
200+
Promise.all([settingRegistry.load(id), app.restored]).then(([settings, args]) => {
196201
function getCurrent(args: ReadonlyJSONObject): NotebookPanel | null {
197202
const widget = tracker.currentWidget;
198203
const activate = args['activate'] !== false;

0 commit comments

Comments
 (0)