@@ -17,10 +17,10 @@ import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
1717import { INotebookEditor } from 'vs/workbench/contrib/notebook/browser/notebookBrowser' ;
1818import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookTextModel' ;
1919import { INotebookCellStatusBarService } from 'vs/workbench/contrib/notebook/common/notebookCellStatusBarService' ;
20- import { ACCESSIBLE_NOTEBOOK_DISPLAY_ORDER , CellEditType , CellKind , DisplayOrderKey , ICellEditOperation , IEditor , INotebookDocumentFilter , INotebookKernelInfo , NotebookCellMetadata , NotebookCellOutputsSplice , NotebookDocumentMetadata , NOTEBOOK_DISPLAY_ORDER , TransientMetadata } from 'vs/workbench/contrib/notebook/common/notebookCommon' ;
20+ import { ACCESSIBLE_NOTEBOOK_DISPLAY_ORDER , CellEditType , CellKind , DisplayOrderKey , ICellEditOperation , ICellRange , IEditor , INotebookDocumentFilter , INotebookKernelInfo , NotebookCellMetadata , NotebookCellOutputsSplice , NotebookDocumentMetadata , NOTEBOOK_DISPLAY_ORDER , TransientMetadata } from 'vs/workbench/contrib/notebook/common/notebookCommon' ;
2121import { IMainNotebookController , INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService' ;
2222import { IEditorService } from 'vs/workbench/services/editor/common/editorService' ;
23- import { ExtHostContext , ExtHostNotebookShape , IExtHostContext , INotebookCellStatusBarEntryDto , INotebookDocumentsAndEditorsDelta , MainContext , MainThreadNotebookShape , NotebookExtensionDescription } from '../common/extHost.protocol' ;
23+ import { ExtHostContext , ExtHostNotebookShape , IExtHostContext , INotebookCellStatusBarEntryDto , INotebookDocumentsAndEditorsDelta , MainContext , MainThreadNotebookShape , NotebookEditorRevealType , NotebookExtensionDescription } from '../common/extHost.protocol' ;
2424
2525class DocumentAndEditorState {
2626 static ofSets < T > ( before : Set < T > , after : Set < T > ) : { removed : T [ ] , added : T [ ] } {
@@ -612,6 +612,32 @@ export class MainThreadNotebooks extends Disposable implements MainThreadNoteboo
612612 textModel ?. handleUnknownChange ( ) ;
613613 }
614614
615+ async $tryRevealRange ( id : string , range : ICellRange , revealType : NotebookEditorRevealType ) {
616+ const editor = this . _notebookService . listNotebookEditors ( ) . find ( editor => editor . getId ( ) === id ) ;
617+ if ( editor && editor . isNotebookEditor ) {
618+ const notebookEditor = editor as INotebookEditor ;
619+ const viewModel = notebookEditor . viewModel ;
620+ const cell = viewModel ?. viewCells [ range . start ] ;
621+ if ( ! cell ) {
622+ return ;
623+ }
624+
625+ switch ( revealType ) {
626+ case NotebookEditorRevealType . Default :
627+ notebookEditor . revealInView ( cell ) ;
628+ break ;
629+ case NotebookEditorRevealType . InCenter :
630+ notebookEditor . revealInCenter ( cell ) ;
631+ break ;
632+ case NotebookEditorRevealType . InCenterIfOutsideViewport :
633+ notebookEditor . revealInCenterIfOutsideViewport ( cell ) ;
634+ break ;
635+ default :
636+ break ;
637+ }
638+ }
639+ }
640+
615641 async $setStatusBarEntry ( id : number , rawStatusBarEntry : INotebookCellStatusBarEntryDto ) : Promise < void > {
616642 const statusBarEntry = {
617643 ...rawStatusBarEntry ,
0 commit comments