Skip to content

Commit

Permalink
reveal cell is async
Browse files Browse the repository at this point in the history
  • Loading branch information
rebornix committed Nov 14, 2023
1 parent 1d150d7 commit 055662f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ export interface INotebookEditor {
/**
* Reveal cell into viewport.
*/
revealInView(cell: ICellViewModel): void;
revealInView(cell: ICellViewModel): Promise<void>;

/**
* Reveal cell into the top of viewport.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2066,7 +2066,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
}

revealInView(cell: ICellViewModel) {
this._list.revealCell(cell, CellRevealType.Default);
return this._list.revealCell(cell, CellRevealType.Default);
}

revealInViewAtTop(cell: ICellViewModel) {
Expand Down Expand Up @@ -2347,7 +2347,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
const firstSelectionPosition = selectionsStartPosition[0];
await this.revealRangeInViewAsync(cell, Range.fromPositions(firstSelectionPosition, firstSelectionPosition));
} else {
this.revealInView(cell);
await this.revealInView(cell);
}
}

Expand Down Expand Up @@ -2385,11 +2385,11 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
if (!options?.skipReveal) {
if (typeof options?.focusEditorLine === 'number') {
this._cursorNavMode.set(true);
this.revealInView(cell);
await this.revealInView(cell);
} else if (options?.revealBehavior === ScrollToRevealBehavior.firstLine) {
this.revealFirstLineIfOutsideViewport(cell);
} else if (options?.revealBehavior === ScrollToRevealBehavior.fullCell) {
this.revealInView(cell);
await this.revealInView(cell);
} else {
this.revealInCenterIfOutsideViewport(cell);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export interface INotebookCellList {
getFocusedElements(): ICellViewModel[];
getSelectedElements(): ICellViewModel[];
scrollToBottom(): void;
revealCell(cell: ICellViewModel, revealType: CellRevealType): void;
revealCell(cell: ICellViewModel, revealType: CellRevealType): Promise<void>;
revealCells(range: ICellRange): void;
revealRangeInCell(cell: ICellViewModel, range: Selection | Range, revealType: CellRevealRangeType): Promise<void>;
revealCellOffsetInCenter(element: ICellViewModel, offset: number): void;
Expand Down

0 comments on commit 055662f

Please sign in to comment.