@@ -3,7 +3,7 @@ import { INotebookTracker, Notebook } from '@jupyterlab/notebook';
33import JupyterlabCodeFormatterClient from './client' ;
44import { IEditorTracker } from '@jupyterlab/fileeditor' ;
55import { Widget } from '@lumino/widgets' ;
6- import { showErrorMessage } from '@jupyterlab/apputils' ;
6+ import { showErrorMessage , Dialog , showDialog } from '@jupyterlab/apputils' ;
77
88class JupyterlabCodeFormatter {
99 working = false ;
@@ -166,10 +166,20 @@ export class JupyterlabNotebookCodeFormatter extends JupyterlabCodeFormatter {
166166 if ( cellValueHasNotChanged ) {
167167 if ( formattedText . error ) {
168168 if ( showErrors ) {
169- await showErrorMessage (
170- 'Jupyterlab Code Formatter Error' ,
171- formattedText . error
172- ) ;
169+ const result = await showDialog (
170+ {
171+ title : 'Jupyterlab Code Formatter Error' ,
172+ body : formattedText . error ,
173+ buttons : [
174+ Dialog . createButton ( { label : 'Go to cell' , actions : [ 'revealError' ] } ) ,
175+ Dialog . okButton ( { label : 'Dismiss' } ) ,
176+ ]
177+ }
178+ )
179+ if ( result . button . actions . indexOf ( 'revealError' ) !== - 1 ) {
180+ this . notebookTracker . currentWidget ! . content . scrollToCell ( cell )
181+ break
182+ }
173183 }
174184 } else {
175185 cell . model . sharedModel . source = formattedText . code ;
0 commit comments