@@ -51,6 +51,7 @@ import { IInteractiveDocumentService, InteractiveDocumentService } from 'vs/work
51
51
import { InteractiveEditor } from 'vs/workbench/contrib/interactive/browser/interactiveEditor' ;
52
52
import { InteractiveEditorInput } from 'vs/workbench/contrib/interactive/browser/interactiveEditorInput' ;
53
53
import { IInteractiveHistoryService , InteractiveHistoryService } from 'vs/workbench/contrib/interactive/browser/interactiveHistoryService' ;
54
+ import { InteractiveWindowFileSystem } from 'vs/workbench/contrib/interactive/browser/interactiveWindowFileSystem' ;
54
55
import { NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT } from 'vs/workbench/contrib/notebook/browser/controller/coreActions' ;
55
56
import { INotebookEditorOptions } from 'vs/workbench/contrib/notebook/browser/notebookBrowser' ;
56
57
import { NotebookEditorWidget } from 'vs/workbench/contrib/notebook/browser/notebookEditorWidget' ;
@@ -95,6 +96,9 @@ export class InteractiveDocumentContribution extends Disposable implements IWork
95
96
cellContentMetadata : { }
96
97
} ;
97
98
99
+ const interactiveWindowFS = new InteractiveWindowFileSystem ( ) ;
100
+ this . _register ( fileService . registerProvider ( Schemas . vscodeInteractive , interactiveWindowFS ) ) ;
101
+
98
102
const serializer : INotebookSerializer = {
99
103
options : contentOptions ,
100
104
dataToNotebook : async ( data : VSBuffer ) : Promise < NotebookData > => {
@@ -201,9 +205,7 @@ export class InteractiveDocumentContribution extends Disposable implements IWork
201
205
priority : RegisteredEditorPriority . exclusive
202
206
} ,
203
207
{
204
- canSupportResource : uri =>
205
- ( uri . scheme === Schemas . untitled && extname ( uri ) === '.interactive' ) ||
206
- ( uri . scheme === Schemas . vscodeNotebookCell && extname ( uri ) === '.interactive' ) ,
208
+ canSupportResource : uri => uri . scheme === Schemas . vscodeInteractive || ( uri . scheme === Schemas . vscodeNotebookCell && extname ( uri ) === '.interactive' ) ,
207
209
singlePerResource : true
208
210
} ,
209
211
{
@@ -369,7 +371,7 @@ registerAction2(class extends Action2 {
369
371
preserveFocus : typeof showOptions !== 'number' ? ( showOptions ?. preserveFocus ?? false ) : false
370
372
} ;
371
373
372
- if ( resource && extname ( resource ) === '.interactive' ) {
374
+ if ( resource && resource . scheme === Schemas . vscodeInteractive ) {
373
375
logService . debug ( 'Open interactive window from resource:' , resource . toString ( ) ) ;
374
376
const resourceUri = URI . revive ( resource ) ;
375
377
const editors = editorService . findEditors ( resourceUri ) . filter ( id => id . editor instanceof InteractiveEditorInput && id . editor . resource ?. toString ( ) === resourceUri . toString ( ) ) ;
@@ -399,7 +401,7 @@ registerAction2(class extends Action2 {
399
401
let inputUri : URI | undefined = undefined ;
400
402
let counter = 1 ;
401
403
do {
402
- notebookUri = URI . from ( { scheme : Schemas . untitled , path : `/Interactive-${ counter } .interactive` } ) ;
404
+ notebookUri = URI . from ( { scheme : Schemas . vscodeInteractive , path : `/Interactive-${ counter } .interactive` } ) ;
403
405
inputUri = URI . from ( { scheme : Schemas . vscodeInteractiveInput , path : `/InteractiveInput-${ counter } ` } ) ;
404
406
405
407
counter ++ ;
@@ -433,7 +435,7 @@ registerAction2(class extends Action2 {
433
435
category : interactiveWindowCategory ,
434
436
keybinding : {
435
437
// when: NOTEBOOK_CELL_LIST_FOCUSED,
436
- when : ContextKeyExpr . equals ( 'activeEditor ' , 'workbench.editor.interactive' ) ,
438
+ when : ContextKeyExpr . equals ( 'resourceScheme ' , Schemas . vscodeInteractive ) ,
437
439
primary : KeyMod . WinCtrl | KeyCode . Enter ,
438
440
win : {
439
441
primary : KeyMod . CtrlCmd | KeyCode . Enter
@@ -467,14 +469,15 @@ registerAction2(class extends Action2 {
467
469
const notebookEditorService = accessor . get ( INotebookEditorService ) ;
468
470
let editorControl : { notebookEditor : NotebookEditorWidget | undefined ; codeEditor : CodeEditorWidget } | undefined ;
469
471
if ( context ) {
470
- const resourceUri = URI . revive ( context ) ;
471
- const editors = editorService . findEditors ( resourceUri )
472
- . filter ( id => id . editor instanceof InteractiveEditorInput && id . editor . resource ?. toString ( ) === resourceUri . toString ( ) ) ;
473
- if ( editors . length ) {
474
- const editorInput = editors [ 0 ] . editor as InteractiveEditorInput ;
475
- const currentGroup = editors [ 0 ] . groupId ;
476
- const editor = await editorService . openEditor ( editorInput , currentGroup ) ;
477
- editorControl = editor ?. getControl ( ) as { notebookEditor : NotebookEditorWidget | undefined ; codeEditor : CodeEditorWidget } | undefined ;
472
+ if ( context . scheme === Schemas . vscodeInteractive ) {
473
+ const resourceUri = URI . revive ( context ) ;
474
+ const editors = editorService . findEditors ( resourceUri ) . filter ( id => id . editor instanceof InteractiveEditorInput && id . editor . resource ?. toString ( ) === resourceUri . toString ( ) ) ;
475
+ if ( editors . length ) {
476
+ const editorInput = editors [ 0 ] . editor as InteractiveEditorInput ;
477
+ const currentGroup = editors [ 0 ] . groupId ;
478
+ const editor = await editorService . openEditor ( editorInput , currentGroup ) ;
479
+ editorControl = editor ?. getControl ( ) as { notebookEditor : NotebookEditorWidget | undefined ; codeEditor : CodeEditorWidget } | undefined ;
480
+ }
478
481
}
479
482
}
480
483
else {
@@ -575,7 +578,7 @@ registerAction2(class extends Action2 {
575
578
f1 : false ,
576
579
keybinding : {
577
580
when : ContextKeyExpr . and (
578
- ContextKeyExpr . equals ( 'activeEditor ' , 'workbench.editor.interactive' ) ,
581
+ ContextKeyExpr . equals ( 'resourceScheme ' , Schemas . vscodeInteractive ) ,
579
582
INTERACTIVE_INPUT_CURSOR_BOUNDARY . notEqualsTo ( 'bottom' ) ,
580
583
INTERACTIVE_INPUT_CURSOR_BOUNDARY . notEqualsTo ( 'none' ) ,
581
584
SuggestContext . Visible . toNegated ( )
@@ -614,7 +617,7 @@ registerAction2(class extends Action2 {
614
617
f1 : false ,
615
618
keybinding : {
616
619
when : ContextKeyExpr . and (
617
- ContextKeyExpr . equals ( 'activeEditor ' , 'workbench.editor.interactive' ) ,
620
+ ContextKeyExpr . equals ( 'resourceScheme ' , Schemas . vscodeInteractive ) ,
618
621
INTERACTIVE_INPUT_CURSOR_BOUNDARY . notEqualsTo ( 'top' ) ,
619
622
INTERACTIVE_INPUT_CURSOR_BOUNDARY . notEqualsTo ( 'none' ) ,
620
623
SuggestContext . Visible . toNegated ( )
@@ -651,7 +654,7 @@ registerAction2(class extends Action2 {
651
654
id : 'interactive.scrollToTop' ,
652
655
title : localize ( 'interactiveScrollToTop' , 'Scroll to Top' ) ,
653
656
keybinding : {
654
- when : ContextKeyExpr . equals ( 'activeEditor ' , 'workbench.editor.interactive' ) ,
657
+ when : ContextKeyExpr . equals ( 'resourceScheme ' , Schemas . vscodeInteractive ) ,
655
658
primary : KeyMod . CtrlCmd | KeyCode . Home ,
656
659
mac : { primary : KeyMod . CtrlCmd | KeyCode . UpArrow } ,
657
660
weight : KeybindingWeight . WorkbenchContrib
@@ -680,7 +683,7 @@ registerAction2(class extends Action2 {
680
683
id : 'interactive.scrollToBottom' ,
681
684
title : localize ( 'interactiveScrollToBottom' , 'Scroll to Bottom' ) ,
682
685
keybinding : {
683
- when : ContextKeyExpr . equals ( 'activeEditor ' , 'workbench.editor.interactive' ) ,
686
+ when : ContextKeyExpr . equals ( 'resourceScheme ' , Schemas . vscodeInteractive ) ,
684
687
primary : KeyMod . CtrlCmd | KeyCode . End ,
685
688
mac : { primary : KeyMod . CtrlCmd | KeyCode . DownArrow } ,
686
689
weight : KeybindingWeight . WorkbenchContrib
@@ -747,9 +750,9 @@ registerAction2(class extends Action2 {
747
750
category : interactiveWindowCategory ,
748
751
menu : {
749
752
id : MenuId . CommandPalette ,
750
- when : ContextKeyExpr . equals ( 'activeEditor ' , 'workbench.editor.interactive' ) ,
753
+ when : ContextKeyExpr . equals ( 'resourceScheme ' , Schemas . vscodeInteractive ) ,
751
754
} ,
752
- precondition : ContextKeyExpr . equals ( 'activeEditor ' , 'workbench.editor.interactive' ) ,
755
+ precondition : ContextKeyExpr . equals ( 'resourceScheme ' , Schemas . vscodeInteractive ) ,
753
756
} ) ;
754
757
}
755
758
0 commit comments