@@ -21,6 +21,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
2121import { IStorageService } from 'vs/platform/storage/common/storage' ;
2222import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry' ;
2323import { IThemeService } from 'vs/platform/theme/common/themeService' ;
24+ import { Selection } from 'vs/editor/common/core/selection' ;
2425import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane' ;
2526import { DEFAULT_EDITOR_ASSOCIATION , EditorInputCapabilities , EditorPaneSelectionChangeReason , EditorPaneSelectionCompareResult , EditorResourceAccessor , IEditorMemento , IEditorOpenContext , IEditorPaneSelection , IEditorPaneSelectionChangeEvent , createEditorOpenError } from 'vs/workbench/common/editor' ;
2627import { EditorInput } from 'vs/workbench/common/editor/editorInput' ;
@@ -354,9 +355,10 @@ export class NotebookEditor extends EditorPane implements INotebookEditorPane {
354355
355356 getSelection ( ) : IEditorPaneSelection | undefined {
356357 if ( this . _widget . value ) {
357- const cellUri = this . _widget . value . getActiveCell ( ) ?. uri ;
358- if ( cellUri ) {
359- return new NotebookEditorSelection ( cellUri ) ;
358+ const activeCell = this . _widget . value . getActiveCell ( ) ;
359+ if ( activeCell ) {
360+ const cellUri = activeCell . uri ;
361+ return new NotebookEditorSelection ( cellUri , activeCell . getSelections ( ) ) ;
360362 }
361363 }
362364
@@ -421,7 +423,8 @@ export class NotebookEditor extends EditorPane implements INotebookEditorPane {
421423class NotebookEditorSelection implements IEditorPaneSelection {
422424
423425 constructor (
424- private readonly cellUri : URI
426+ private readonly cellUri : URI ,
427+ private readonly selections : Selection [ ]
425428 ) { }
426429
427430 compare ( other : IEditorPaneSelection ) : EditorPaneSelectionCompareResult {
@@ -439,7 +442,10 @@ class NotebookEditorSelection implements IEditorPaneSelection {
439442 restore ( options : IEditorOptions ) : INotebookEditorOptions {
440443 const notebookOptions : INotebookEditorOptions = {
441444 cellOptions : {
442- resource : this . cellUri
445+ resource : this . cellUri ,
446+ options : {
447+ selection : this . selections [ 0 ]
448+ }
443449 }
444450 } ;
445451
0 commit comments