提交 d0fc46e2 编写于 作者: R Rob Lourens

Fix focusing next cell after shift+enter/ctrl+enter

Fix #99156
上级 c5c0989c
......@@ -18,7 +18,7 @@ import { InputFocusedContext, InputFocusedContextKey } from 'vs/platform/context
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { IQuickInputService, IQuickPickItem, QuickPickInput } from 'vs/platform/quickinput/common/quickInput';
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';
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';
import { CellKind, NOTEBOOK_EDITOR_CURSOR_BOUNDARY, NotebookCellRunState } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
......@@ -221,11 +221,12 @@ registerAction2(class extends NotebookAction {
return;
}
const newFocusMode = context.cell.focusMode === CellFocusMode.Editor ? 'editor' : 'container';
const executionP = runCell(context);
// Try to select below, fall back on inserting
const nextCell = context.notebookEditor.viewModel?.viewCells[idx + 1];
const newFocusMode = context.cell.editState === CellEditState.Editing ? 'editor' : 'container';
if (nextCell) {
context.notebookEditor.focusNotebookCell(nextCell, newFocusMode);
} else {
......@@ -256,10 +257,12 @@ registerAction2(class extends NotebookAction {
}
async runWithContext(accessor: ServicesAccessor, context: INotebookCellActionContext): Promise<void> {
const newFocusMode = context.cell.focusMode === CellFocusMode.Editor ? 'editor' : 'container';
const executionP = runCell(context);
const newCell = context.notebookEditor.insertNotebookCell(context.cell, CellKind.Code, 'below');
if (newCell) {
context.notebookEditor.focusNotebookCell(newCell, context.cell.editState === CellEditState.Editing ? 'editor' : 'container');
context.notebookEditor.focusNotebookCell(newCell, newFocusMode);
}
return executionP;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册