@@ -21,6 +21,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
21
21
import { IStorageService } from 'vs/platform/storage/common/storage' ;
22
22
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry' ;
23
23
import { IThemeService } from 'vs/platform/theme/common/themeService' ;
24
+ import { Selection } from 'vs/editor/common/core/selection' ;
24
25
import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane' ;
25
26
import { DEFAULT_EDITOR_ASSOCIATION , EditorInputCapabilities , EditorPaneSelectionChangeReason , EditorPaneSelectionCompareResult , EditorResourceAccessor , IEditorMemento , IEditorOpenContext , IEditorPaneSelection , IEditorPaneSelectionChangeEvent , createEditorOpenError } from 'vs/workbench/common/editor' ;
26
27
import { EditorInput } from 'vs/workbench/common/editor/editorInput' ;
@@ -354,9 +355,10 @@ export class NotebookEditor extends EditorPane implements INotebookEditorPane {
354
355
355
356
getSelection ( ) : IEditorPaneSelection | undefined {
356
357
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 ( ) ) ;
360
362
}
361
363
}
362
364
@@ -421,7 +423,8 @@ export class NotebookEditor extends EditorPane implements INotebookEditorPane {
421
423
class NotebookEditorSelection implements IEditorPaneSelection {
422
424
423
425
constructor (
424
- private readonly cellUri : URI
426
+ private readonly cellUri : URI ,
427
+ private readonly selections : Selection [ ]
425
428
) { }
426
429
427
430
compare ( other : IEditorPaneSelection ) : EditorPaneSelectionCompareResult {
@@ -439,7 +442,10 @@ class NotebookEditorSelection implements IEditorPaneSelection {
439
442
restore ( options : IEditorOptions ) : INotebookEditorOptions {
440
443
const notebookOptions : INotebookEditorOptions = {
441
444
cellOptions : {
442
- resource : this . cellUri
445
+ resource : this . cellUri ,
446
+ options : {
447
+ selection : this . selections [ 0 ]
448
+ }
443
449
}
444
450
} ;
445
451
0 commit comments