@@ -9,6 +9,7 @@ import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
9
9
import { Disposable , IDisposable } from 'vs/base/common/lifecycle' ;
10
10
import { parse } from 'vs/base/common/marshalling' ;
11
11
import { Schemas } from 'vs/base/common/network' ;
12
+ import { extname } from 'vs/base/common/resources' ;
12
13
import { isFalsyOrWhitespace } from 'vs/base/common/strings' ;
13
14
import { assertType } from 'vs/base/common/types' ;
14
15
import { URI } from 'vs/base/common/uri' ;
@@ -25,7 +26,7 @@ import { localize } from 'vs/nls';
25
26
import { Action2 , MenuId , registerAction2 } from 'vs/platform/actions/common/actions' ;
26
27
import { IConfigurationRegistry , Extensions as ConfigurationExtensions } from 'vs/platform/configuration/common/configurationRegistry' ;
27
28
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey' ;
28
- import { EditorActivation } from 'vs/platform/editor/common/editor' ;
29
+ import { EditorActivation , IResourceEditorInput } from 'vs/platform/editor/common/editor' ;
29
30
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions' ;
30
31
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors' ;
31
32
import { registerSingleton } from 'vs/platform/instantiation/common/extensions' ;
@@ -48,9 +49,10 @@ import { InteractiveEditor } from 'vs/workbench/contrib/interactive/browser/inte
48
49
import { InteractiveEditorInput } from 'vs/workbench/contrib/interactive/browser/interactiveEditorInput' ;
49
50
import { IInteractiveHistoryService , InteractiveHistoryService } from 'vs/workbench/contrib/interactive/browser/interactiveHistoryService' ;
50
51
import { NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT } from 'vs/workbench/contrib/notebook/browser/controller/coreActions' ;
52
+ import { INotebookEditorOptions } from 'vs/workbench/contrib/notebook/browser/notebookBrowser' ;
51
53
import { NotebookEditorWidget } from 'vs/workbench/contrib/notebook/browser/notebookEditorWidget' ;
52
54
import * as icons from 'vs/workbench/contrib/notebook/browser/notebookIcons' ;
53
- import { CellEditType , CellKind , ICellOutput , NotebookSetting } from 'vs/workbench/contrib/notebook/common/notebookCommon' ;
55
+ import { CellEditType , CellKind , CellUri , ICellOutput , NotebookSetting } from 'vs/workbench/contrib/notebook/common/notebookCommon' ;
54
56
import { INotebookKernelService } from 'vs/workbench/contrib/notebook/common/notebookKernelService' ;
55
57
import { INotebookContentProvider , INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService' ;
56
58
import { columnToEditorGroup } from 'vs/workbench/services/editor/common/editorGroupColumn' ;
@@ -214,12 +216,26 @@ export class InteractiveDocumentContribution extends Disposable implements IWork
214
216
priority : RegisteredEditorPriority . exclusive
215
217
} ,
216
218
{
217
- canSupportResource : uri => uri . scheme === Schemas . vscodeInteractive ,
219
+ canSupportResource : uri => uri . scheme === Schemas . vscodeInteractive || ( uri . scheme === Schemas . vscodeNotebookCell && extname ( uri ) === '.interactive' ) ,
218
220
singlePerResource : true
219
221
} ,
220
- ( { resource } ) => {
221
- const editorInput = editorService . getEditors ( EditorsOrder . SEQUENTIAL ) . find ( editor => editor . editor instanceof InteractiveEditorInput && editor . editor . resource ?. toString ( ) === resource . toString ( ) ) ;
222
- return editorInput ! ;
222
+ ( { resource, options } ) => {
223
+ const data = CellUri . parse ( resource ) ;
224
+ let notebookUri : URI = resource ;
225
+ let cellOptions : IResourceEditorInput | undefined ;
226
+
227
+ if ( data ) {
228
+ notebookUri = data . notebook ;
229
+ cellOptions = { resource, options } ;
230
+ }
231
+
232
+ const notebookOptions = { ...options , cellOptions } as INotebookEditorOptions ;
233
+
234
+ const editorInput = editorService . getEditors ( EditorsOrder . SEQUENTIAL ) . find ( editor => editor . editor instanceof InteractiveEditorInput && editor . editor . resource ?. toString ( ) === notebookUri . toString ( ) ) ;
235
+ return {
236
+ editor : editorInput ! . editor ,
237
+ options : notebookOptions
238
+ } ;
223
239
}
224
240
) ;
225
241
}
0 commit comments