@@ -226,11 +226,11 @@ registerAction2(class extends NotebookAction {
226
226
// Try to select below, fall back on inserting
227
227
const nextCell = context . notebookEditor . viewModel ?. viewCells [ idx + 1 ] ;
228
228
if ( nextCell ) {
229
- context . notebookEditor . focusNotebookCell ( nextCell , context . cell . editState === CellEditState . Editing ? 'editor' : 'container' ) ;
229
+ await context . notebookEditor . focusNotebookCell ( nextCell , context . cell . editState === CellEditState . Editing ? 'editor' : 'container' ) ;
230
230
} else {
231
231
const newCell = context . notebookEditor . insertNotebookCell ( context . cell , CellKind . Code , 'below' ) ;
232
232
if ( newCell ) {
233
- context . notebookEditor . focusNotebookCell ( newCell , 'editor' ) ;
233
+ await context . notebookEditor . focusNotebookCell ( newCell , 'editor' ) ;
234
234
}
235
235
}
236
236
}
@@ -256,7 +256,7 @@ registerAction2(class extends NotebookAction {
256
256
await runCell ( context ) ;
257
257
const newCell = context . notebookEditor . insertNotebookCell ( context . cell , CellKind . Code , 'below' ) ;
258
258
if ( newCell ) {
259
- context . notebookEditor . focusNotebookCell ( newCell , 'editor' ) ;
259
+ await context . notebookEditor . focusNotebookCell ( newCell , 'editor' ) ;
260
260
}
261
261
}
262
262
} ) ;
@@ -313,7 +313,7 @@ registerAction2(class extends NotebookAction {
313
313
context . cell . editState = CellEditState . Preview ;
314
314
}
315
315
316
- context . notebookEditor . focusNotebookCell ( context . cell , 'container' ) ;
316
+ await context . notebookEditor . focusNotebookCell ( context . cell , 'container' ) ;
317
317
}
318
318
} ) ;
319
319
@@ -436,7 +436,7 @@ export async function changeCellToKind(kind: CellKind, context: INotebookCellAct
436
436
newCell . model . language = language ;
437
437
}
438
438
439
- notebookEditor . focusNotebookCell ( newCell , cell . editState === CellEditState . Editing ? 'editor' : 'container' ) ;
439
+ await notebookEditor . focusNotebookCell ( newCell , cell . editState === CellEditState . Editing ? 'editor' : 'container' ) ;
440
440
notebookEditor . deleteNotebookCell ( cell ) ;
441
441
442
442
return newCell ;
@@ -461,7 +461,7 @@ abstract class InsertCellCommand extends NotebookAction {
461
461
async runWithContext ( accessor : ServicesAccessor , context : INotebookCellActionContext ) : Promise < void > {
462
462
const newCell = context . notebookEditor . insertNotebookCell ( context . cell , this . kind , this . direction , undefined , context . ui ) ;
463
463
if ( newCell ) {
464
- context . notebookEditor . focusNotebookCell ( newCell , 'editor' ) ;
464
+ await context . notebookEditor . focusNotebookCell ( newCell , 'editor' ) ;
465
465
}
466
466
}
467
467
}
@@ -656,12 +656,12 @@ registerAction2(class extends NotebookAction {
656
656
// deletion succeeds, move focus to the next cell
657
657
const nextCellIdx = index < context . notebookEditor . viewModel ! . length ? index : context . notebookEditor . viewModel ! . length - 1 ;
658
658
if ( nextCellIdx >= 0 ) {
659
- context . notebookEditor . focusNotebookCell ( context . notebookEditor . viewModel ! . viewCells [ nextCellIdx ] , 'container' ) ;
659
+ await context . notebookEditor . focusNotebookCell ( context . notebookEditor . viewModel ! . viewCells [ nextCellIdx ] , 'container' ) ;
660
660
} else {
661
661
// No cells left, insert a new empty one
662
662
const newCell = context . notebookEditor . insertNotebookCell ( undefined , context . cell . cellKind ) ;
663
663
if ( newCell ) {
664
- context . notebookEditor . focusNotebookCell ( newCell , 'editor' ) ;
664
+ await context . notebookEditor . focusNotebookCell ( newCell , 'editor' ) ;
665
665
}
666
666
}
667
667
}
@@ -675,7 +675,7 @@ async function moveCell(context: INotebookCellActionContext, direction: 'up' | '
675
675
676
676
if ( result ) {
677
677
// move cell command only works when the cell container has focus
678
- context . notebookEditor . focusNotebookCell ( context . cell , 'container' ) ;
678
+ await context . notebookEditor . focusNotebookCell ( context . cell , 'container' ) ;
679
679
}
680
680
}
681
681
@@ -684,7 +684,7 @@ async function copyCell(context: INotebookCellActionContext, direction: 'up' | '
684
684
const newCellDirection = direction === 'up' ? 'above' : 'below' ;
685
685
const newCell = context . notebookEditor . insertNotebookCell ( context . cell , context . cell . cellKind , newCellDirection , text ) ;
686
686
if ( newCell ) {
687
- context . notebookEditor . focusNotebookCell ( newCell , 'container' ) ;
687
+ await context . notebookEditor . focusNotebookCell ( newCell , 'container' ) ;
688
688
}
689
689
}
690
690
@@ -935,7 +935,7 @@ registerAction2(class extends NotebookAction {
935
935
return ;
936
936
}
937
937
938
- editor . focusNotebookCell ( newCell , 'editor' ) ;
938
+ await editor . focusNotebookCell ( newCell , 'editor' ) ;
939
939
}
940
940
} ) ;
941
941
@@ -973,7 +973,7 @@ registerAction2(class extends NotebookAction {
973
973
return ;
974
974
}
975
975
976
- editor . focusNotebookCell ( newCell , 'editor' ) ;
976
+ await editor . focusNotebookCell ( newCell , 'editor' ) ;
977
977
}
978
978
} ) ;
979
979
@@ -997,7 +997,7 @@ registerAction2(class extends NotebookAction {
997
997
async runWithContext ( accessor : ServicesAccessor , context : INotebookCellActionContext ) : Promise < void > {
998
998
const editor = context . notebookEditor ;
999
999
const activeCell = context . cell ;
1000
- editor . focusNotebookCell ( activeCell , 'output' ) ;
1000
+ await editor . focusNotebookCell ( activeCell , 'output' ) ;
1001
1001
}
1002
1002
} ) ;
1003
1003
@@ -1021,7 +1021,7 @@ registerAction2(class extends NotebookAction {
1021
1021
async runWithContext ( accessor : ServicesAccessor , context : INotebookCellActionContext ) : Promise < void > {
1022
1022
const editor = context . notebookEditor ;
1023
1023
const activeCell = context . cell ;
1024
- editor . focusNotebookCell ( activeCell , 'editor' ) ;
1024
+ await editor . focusNotebookCell ( activeCell , 'editor' ) ;
1025
1025
}
1026
1026
} ) ;
1027
1027
@@ -1094,7 +1094,7 @@ registerAction2(class extends NotebookAction {
1094
1094
}
1095
1095
1096
1096
const firstCell = editor . viewModel . viewCells [ 0 ] ;
1097
- editor . focusNotebookCell ( firstCell , 'container' ) ;
1097
+ await editor . focusNotebookCell ( firstCell , 'container' ) ;
1098
1098
}
1099
1099
} ) ;
1100
1100
@@ -1122,7 +1122,7 @@ registerAction2(class extends NotebookAction {
1122
1122
}
1123
1123
1124
1124
const firstCell = editor . viewModel . viewCells [ editor . viewModel . length - 1 ] ;
1125
- editor . focusNotebookCell ( firstCell , 'container' ) ;
1125
+ await editor . focusNotebookCell ( firstCell , 'container' ) ;
1126
1126
}
1127
1127
} ) ;
1128
1128
@@ -1225,7 +1225,7 @@ export class ChangeCellLanguageAction extends NotebookAction {
1225
1225
if ( selection . languageId === 'markdown' && context . cell ?. language !== 'markdown' ) {
1226
1226
const newCell = await changeCellToKind ( CellKind . Markdown , { cell : context . cell , notebookEditor : context . notebookEditor } ) ;
1227
1227
if ( newCell ) {
1228
- context . notebookEditor . focusNotebookCell ( newCell , 'editor' ) ;
1228
+ await context . notebookEditor . focusNotebookCell ( newCell , 'editor' ) ;
1229
1229
}
1230
1230
} else if ( selection . languageId !== 'markdown' && context . cell ?. language === 'markdown' ) {
1231
1231
await changeCellToKind ( CellKind . Code , { cell : context . cell , notebookEditor : context . notebookEditor } , selection . languageId ) ;
@@ -1288,7 +1288,7 @@ async function splitCell(context: INotebookCellActionContext): Promise<void> {
1288
1288
if ( context . cell . cellKind === CellKind . Code ) {
1289
1289
const newCells = await context . notebookEditor . splitNotebookCell ( context . cell ) ;
1290
1290
if ( newCells ) {
1291
- context . notebookEditor . focusNotebookCell ( newCells [ newCells . length - 1 ] , 'editor' ) ;
1291
+ await context . notebookEditor . focusNotebookCell ( newCells [ newCells . length - 1 ] , 'editor' ) ;
1292
1292
}
1293
1293
}
1294
1294
}
@@ -1320,7 +1320,7 @@ registerAction2(class extends NotebookAction {
1320
1320
async function joinCells ( context : INotebookCellActionContext , direction : 'above' | 'below' ) : Promise < void > {
1321
1321
const cell = await context . notebookEditor . joinNotebookCells ( context . cell , direction , CellKind . Code ) ;
1322
1322
if ( cell ) {
1323
- context . notebookEditor . focusNotebookCell ( cell , 'editor' ) ;
1323
+ await context . notebookEditor . focusNotebookCell ( cell , 'editor' ) ;
1324
1324
}
1325
1325
}
1326
1326
0 commit comments