@@ -634,10 +634,8 @@ registerAction2(class CommentSelectedCellsAction extends NotebookMultiCellAction
634
634
keybinding : {
635
635
when : ContextKeyExpr . and (
636
636
NOTEBOOK_EDITOR_FOCUSED ,
637
- NOTEBOOK_CELL_LIST_FOCUSED ,
638
- ContextKeyExpr . not ( InputFocusedContextKey ) ,
639
637
NOTEBOOK_EDITOR_EDITABLE ,
640
- NOTEBOOK_CELL_EDITABLE
638
+ ContextKeyExpr . not ( InputFocusedContextKey ) ,
641
639
) ,
642
640
primary : KeyMod . CtrlCmd | KeyCode . Slash ,
643
641
weight : KeybindingWeight . WorkbenchContrib
@@ -657,6 +655,7 @@ registerAction2(class CommentSelectedCellsAction extends NotebookMultiCellAction
657
655
}
658
656
} ) ;
659
657
658
+
660
659
selectedCellEditors . forEach ( editor => {
661
660
if ( ! editor . hasModel ( ) ) {
662
661
return ;
@@ -667,6 +666,8 @@ registerAction2(class CommentSelectedCellsAction extends NotebookMultiCellAction
667
666
const modelOptions = model . getOptions ( ) ;
668
667
const commentsOptions = editor . getOption ( EditorOption . comments ) ;
669
668
669
+ const selection = editor . getSelection ( ) ;
670
+
670
671
commands . push ( new LineCommentCommand (
671
672
languageConfigurationService ,
672
673
new Selection ( 1 , 1 , model . getLineCount ( ) , model . getLineMaxColumn ( model . getLineCount ( ) ) ) ,
@@ -680,6 +681,8 @@ registerAction2(class CommentSelectedCellsAction extends NotebookMultiCellAction
680
681
editor . pushUndoStop ( ) ;
681
682
editor . executeCommands ( COMMENT_SELECTED_CELLS_ID , commands ) ;
682
683
editor . pushUndoStop ( ) ;
684
+
685
+ editor . setSelection ( selection ) ;
683
686
} ) ;
684
687
}
685
688
0 commit comments