@@ -18,7 +18,7 @@ import { InputFocusedContext, InputFocusedContextKey } from 'vs/platform/context
1818import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation' ;
1919import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry' ;
2020import { IQuickInputService , IQuickPickItem , QuickPickInput } from 'vs/platform/quickinput/common/quickInput' ;
21- import { BaseCellRenderTemplate , CellEditState , ICellViewModel , INotebookEditor , NOTEBOOK_CELL_EDITABLE , NOTEBOOK_CELL_MARKDOWN_EDIT_MODE , NOTEBOOK_CELL_RUNNABLE , NOTEBOOK_CELL_TYPE , NOTEBOOK_EDITOR_EDITABLE , NOTEBOOK_EDITOR_EXECUTING_NOTEBOOK , NOTEBOOK_EDITOR_FOCUSED , NOTEBOOK_EDITOR_RUNNABLE , NOTEBOOK_IS_ACTIVE_EDITOR , NOTEBOOK_CELL_HAS_OUTPUTS } from 'vs/workbench/contrib/notebook/browser/notebookBrowser' ;
21+ import { BaseCellRenderTemplate , CellEditState , ICellViewModel , INotebookEditor , NOTEBOOK_CELL_EDITABLE , NOTEBOOK_CELL_MARKDOWN_EDIT_MODE , NOTEBOOK_CELL_RUNNABLE , NOTEBOOK_CELL_TYPE , NOTEBOOK_EDITOR_EDITABLE , NOTEBOOK_EDITOR_EXECUTING_NOTEBOOK , NOTEBOOK_EDITOR_FOCUSED , NOTEBOOK_EDITOR_RUNNABLE , NOTEBOOK_IS_ACTIVE_EDITOR , NOTEBOOK_CELL_HAS_OUTPUTS , CellFocusMode } from 'vs/workbench/contrib/notebook/browser/notebookBrowser' ;
2222import { CellKind , NOTEBOOK_EDITOR_CURSOR_BOUNDARY , NotebookCellRunState } from 'vs/workbench/contrib/notebook/common/notebookCommon' ;
2323import { INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService' ;
2424import { IEditorService } from 'vs/workbench/services/editor/common/editorService' ;
@@ -221,11 +221,12 @@ registerAction2(class extends NotebookAction {
221221 return ;
222222 }
223223
224+ const newFocusMode = context . cell . focusMode === CellFocusMode . Editor ? 'editor' : 'container' ;
225+
224226 const executionP = runCell ( context ) ;
225227
226228 // Try to select below, fall back on inserting
227229 const nextCell = context . notebookEditor . viewModel ?. viewCells [ idx + 1 ] ;
228- const newFocusMode = context . cell . editState === CellEditState . Editing ? 'editor' : 'container' ;
229230 if ( nextCell ) {
230231 context . notebookEditor . focusNotebookCell ( nextCell , newFocusMode ) ;
231232 } else {
@@ -256,10 +257,12 @@ registerAction2(class extends NotebookAction {
256257 }
257258
258259 async runWithContext ( accessor : ServicesAccessor , context : INotebookCellActionContext ) : Promise < void > {
260+ const newFocusMode = context . cell . focusMode === CellFocusMode . Editor ? 'editor' : 'container' ;
261+
259262 const executionP = runCell ( context ) ;
260263 const newCell = context . notebookEditor . insertNotebookCell ( context . cell , CellKind . Code , 'below' ) ;
261264 if ( newCell ) {
262- context . notebookEditor . focusNotebookCell ( newCell , context . cell . editState === CellEditState . Editing ? 'editor' : 'container' ) ;
265+ context . notebookEditor . focusNotebookCell ( newCell , newFocusMode ) ;
263266 }
264267
265268 return executionP ;
0 commit comments