@@ -28,7 +28,6 @@ const serializer = new class implements vscode.NotebookSerializer {
28
28
) ;
29
29
30
30
cells . push ( cell ) ;
31
-
32
31
}
33
32
return new vscode . NotebookData ( cells ) ;
34
33
}
@@ -52,20 +51,22 @@ export function activate(context: vscode.ExtensionContext) {
52
51
const registration = vscode . notebook . registerNotebookSerializer ( 'regexpnb' , serializer ) ;
53
52
54
53
// "execute" a regular expression
55
- const kernel = vscode . notebook . createNotebookKernel ( {
54
+ const controller = vscode . notebook . createNotebookController ( {
56
55
id : 'regex-kernel' ,
57
56
label : 'RegexNB' ,
58
57
supportedLanguages : [ 'plaintext' ] ,
59
58
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 ( ) ;
66
67
}
67
68
}
68
69
} ) ;
69
70
70
- context . subscriptions . push ( registration , kernel ) ;
71
+ context . subscriptions . push ( registration , controller ) ;
71
72
}
0 commit comments