@@ -3,7 +3,7 @@ import { INotebookTracker, Notebook } from '@jupyterlab/notebook';
3
3
import JupyterlabCodeFormatterClient from './client' ;
4
4
import { IEditorTracker } from '@jupyterlab/fileeditor' ;
5
5
import { Widget } from '@lumino/widgets' ;
6
- import { showErrorMessage } from '@jupyterlab/apputils' ;
6
+ import { showErrorMessage , Dialog , showDialog } from '@jupyterlab/apputils' ;
7
7
8
8
class JupyterlabCodeFormatter {
9
9
working = false ;
@@ -166,10 +166,20 @@ export class JupyterlabNotebookCodeFormatter extends JupyterlabCodeFormatter {
166
166
if ( cellValueHasNotChanged ) {
167
167
if ( formattedText . error ) {
168
168
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
+ }
173
183
}
174
184
} else {
175
185
cell . model . sharedModel . source = formattedText . code ;
0 commit comments