Skip to content

Commit fb064f4

Browse files
committed
adopt to latest API
1 parent 9778b9d commit fb064f4

File tree

2 files changed

+101
-117
lines changed

2 files changed

+101
-117
lines changed

Diff for: src/extension/extension.ts

+10-9
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ const serializer = new class implements vscode.NotebookSerializer {
2828
);
2929

3030
cells.push(cell);
31-
3231
}
3332
return new vscode.NotebookData(cells);
3433
}
@@ -52,20 +51,22 @@ export function activate(context: vscode.ExtensionContext) {
5251
const registration = vscode.notebook.registerNotebookSerializer('regexpnb', serializer);
5352

5453
// "execute" a regular expression
55-
const kernel = vscode.notebook.createNotebookKernel({
54+
const controller = vscode.notebook.createNotebookController({
5655
id: 'regex-kernel',
5756
label: 'RegexNB',
5857
supportedLanguages: ['plaintext'],
5958
selector: { viewType: 'regexpnb' },
60-
executeHandler: executions => {
61-
for (let exec of executions) {
62-
exec.start();
63-
const output = new vscode.NotebookCellOutputItem('application/x.regexp', exec.cell.document.getText());
64-
exec.replaceOutput(new vscode.NotebookCellOutput([output]));
65-
exec.end();
59+
executeHandler: (executions: vscode.NotebookCellExecutionTask[]) => {
60+
for (const execution of executions) {
61+
62+
execution.start();
63+
const cellContent = execution.cell.document.getText();
64+
const regexOutput = new vscode.NotebookCellOutputItem('application/x.regexp', cellContent);
65+
execution.replaceOutput(new vscode.NotebookCellOutput([regexOutput]));
66+
execution.end();
6667
}
6768
}
6869
});
6970

70-
context.subscriptions.push(registration, kernel);
71+
context.subscriptions.push(registration, controller);
7172
}

0 commit comments

Comments
 (0)