@@ -508,11 +508,13 @@ define(function (require, exports, module) {
508508 _populateDummyGutterElements ( editor , from , to ) ;
509509 }
510510
511- function _scrollToTableLine ( lineNumber ) {
511+ function scrollToProblem ( lineNumber ) {
512512 const $lineElement = $problemsPanelTable . find ( 'td.line-number[data-line="' + lineNumber + '"]' ) ;
513513 if ( $lineElement . length ) {
514514 $lineElement [ 0 ] . scrollIntoView ( { behavior : 'instant' , block : 'start' } ) ;
515+ return true ;
515516 }
517+ return false ;
516518 }
517519
518520
@@ -532,7 +534,7 @@ define(function (require, exports, module) {
532534 ${ mark . message } <br/>
533535 </div>` ) ;
534536 $problemView . find ( ".fix-problem-btn" ) . click ( ( ) => {
535- _scrollToTableLine ( pos . line ) ;
537+ scrollToProblem ( pos . line ) ;
536538 _fixProblem ( fixID ) ;
537539 } ) ;
538540 $hoverMessage . append ( $problemView ) ;
@@ -543,7 +545,7 @@ define(function (require, exports, module) {
543545 // eslint-disable-next-line no-loop-func
544546 $problemView . click ( function ( ) {
545547 toggleCollapsed ( false ) ;
546- _scrollToTableLine ( pos . line ) ;
548+ scrollToProblem ( pos . line ) ;
547549 } ) ;
548550 const markPos = mark . find ( ) ;
549551 if ( markPos . from && markPos . from . line < startPos . line ) {
@@ -754,12 +756,10 @@ define(function (require, exports, module) {
754756 // Update results table
755757 html = Mustache . render ( ResultsTemplate , { Strings : Strings , reportList : allErrors } ) ;
756758
757- const scrollPosition = scrollPositionMap . get ( fullFilePath ) || 0 ;
758759 $problemsPanelTable . lintFilePath = fullFilePath ;
759760 $problemsPanelTable
760761 . empty ( )
761- . append ( html )
762- . scrollTop ( scrollPosition ) ; // otherwise scroll pos from previous contents is remembered
762+ . append ( html ) ; // otherwise scroll pos from previous contents is remembered
763763
764764 if ( ! _collapsed ) {
765765 problemsPanel . show ( ) ;
@@ -769,6 +769,8 @@ define(function (require, exports, module) {
769769 path . basename ( fullFilePath ) ) ;
770770 setGotoEnabled ( true ) ;
771771
772+ const scrollPosition = scrollPositionMap . get ( fullFilePath ) || 0 ;
773+ $problemsPanelTable . scrollTop ( scrollPosition ) ;
772774 PerfUtils . addMeasurement ( perfTimerDOM ) ;
773775 } ) ;
774776
@@ -1180,4 +1182,5 @@ define(function (require, exports, module) {
11801182 exports . requestRun = run ;
11811183 exports . getProvidersForPath = getProvidersForPath ;
11821184 exports . getProviderIDsForLanguage = getProviderIDsForLanguage ;
1185+ exports . scrollToProblem = scrollToProblem ;
11831186} ) ;
0 commit comments