File tree Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -349,45 +349,51 @@ export class RNotebookProvider implements vscode.NotebookContentProvider, vscode
349
349
cell . metadata . lastRunDuration = + new Date ( ) - cell . metadata . runStartTime ;
350
350
console . log ( `uri: ${ cell . uri } , id: ${ response . id } , type: ${ response . type } , result: ${ response . result } ` ) ;
351
351
switch ( response . type ) {
352
- case 'text' :
352
+ case 'text' : {
353
353
cell . outputs = [ {
354
354
outputKind : vscode . CellOutputKind . Text ,
355
355
text : response . result ,
356
356
} ] ;
357
357
break ;
358
- case 'plot' :
358
+ }
359
+ case 'plot' : {
360
+ const content = ( await vscode . workspace . fs . readFile ( vscode . Uri . parse ( response . result ) ) ) . toString ( ) ;
359
361
cell . outputs = [ {
360
362
outputKind : vscode . CellOutputKind . Rich ,
361
363
data : {
362
- 'image/svg+xml' : ( await vscode . workspace . fs . readFile ( vscode . Uri . parse ( response . result ) ) ) . toString ( ) ,
364
+ 'image/svg+xml' : content ,
363
365
} ,
364
366
} ] ;
365
367
break ;
366
- case 'viewer' :
368
+ }
369
+ case 'viewer' : {
367
370
cell . outputs = [ {
368
371
outputKind : vscode . CellOutputKind . Rich ,
369
372
data : {
370
- 'application/json ' : response . result ,
373
+ 'text/plain ' : response . result ,
371
374
} ,
372
375
} ] ;
373
376
break ;
374
- case 'browser' :
377
+ }
378
+ case 'browser' : {
375
379
cell . outputs = [ {
376
380
outputKind : vscode . CellOutputKind . Rich ,
377
381
data : {
378
- 'application/json ' : response . result ,
382
+ 'text/plain ' : response . result ,
379
383
} ,
380
384
} ] ;
381
385
break ;
382
- case 'error' :
386
+ }
387
+ case 'error' : {
383
388
cell . metadata . runState = vscode . NotebookCellRunState . Error ;
384
389
cell . outputs = [ {
385
390
outputKind : vscode . CellOutputKind . Error ,
386
391
evalue : response . result ,
387
- ename : '' ,
392
+ ename : 'Error ' ,
388
393
traceback : [ ] ,
389
394
} ] ;
390
395
break ;
396
+ }
391
397
}
392
398
} catch ( e ) {
393
399
cell . outputs = [ {
You can’t perform that action at this time.
0 commit comments