@@ -76,12 +76,20 @@ define(function (require, exports, module) {
7676 META : "meta"
7777 } ;
7878
79- function _getIconClassForType ( type ) {
79+ function _getIconClassForType ( type , isFixable ) {
8080 switch ( type ) {
81- case Type . ERROR : return "line-icon-problem_type_error fa-solid fa-times-circle" ;
82- case Type . WARNING : return "line-icon-problem_type_warning fa-solid fa-exclamation-triangle" ;
83- case Type . META : return "line-icon-problem_type_info fa-solid fa-info-circle" ;
84- default : return "line-icon-problem_type_info fa-solid fa-info-circle" ;
81+ case Type . ERROR : return isFixable ?
82+ "line-icon-problem_type_error fa-solid fa-wrench" :
83+ "line-icon-problem_type_error fa-solid fa-times-circle" ;
84+ case Type . WARNING : return isFixable ?
85+ "line-icon-problem_type_warning fa-solid fa-wrench" :
86+ "line-icon-problem_type_warning fa-solid fa-exclamation-triangle" ;
87+ case Type . META : return isFixable ?
88+ "line-icon-problem_type_info fa-solid fa-wrench" :
89+ "line-icon-problem_type_info fa-solid fa-info-circle" ;
90+ default : return isFixable ?
91+ "line-icon-problem_type_info fa-solid fa-wrench" :
92+ "line-icon-problem_type_info fa-solid fa-info-circle" ;
8593 }
8694 }
8795
@@ -434,17 +442,18 @@ define(function (require, exports, module) {
434442 * @param ch - the character position of the error
435443 * @param type - The type of the marker. This is a string that can be one of the error types
436444 * @param message - The message that will be displayed when you hover over the marker.
445+ * @param isFixable - true if we need to use the fix icon
437446 * @returns A DOM element.
438447 */
439- function _createMarkerElement ( editor , line , ch , type , message ) {
448+ function _createMarkerElement ( editor , line , ch , type , message , isFixable ) {
440449 let $marker = $ ( '<div><span>' )
441450 . attr ( 'title' , message )
442451 . addClass ( CODE_INSPECTION_GUTTER ) ;
443452 $marker . click ( function ( ) {
444453 editor . setCursorPos ( line , ch ) ;
445454 } ) ;
446455 $marker . find ( 'span' )
447- . addClass ( _getIconClassForType ( type ) )
456+ . addClass ( _getIconClassForType ( type , isFixable ) )
448457 . addClass ( "brackets-inspection-gutter-marker" )
449458 . html ( ' ' ) ;
450459 return $marker [ 0 ] ;
@@ -477,7 +486,11 @@ define(function (require, exports, module) {
477486 for ( let lineno of Object . keys ( gutterErrorMessages ) ) {
478487 // We mark the line with the Highest priority icon. (Eg. error icon if same line has warnings and info)
479488 let highestPriorityMarkTypeSeen = Type . META ;
489+ let fixableMarkFound = false ;
480490 let gutterMessage = gutterErrorMessages [ lineno ] . reduce ( ( prev , current ) => {
491+ if ( current . fixable || prev . fixable ) {
492+ fixableMarkFound = true ;
493+ }
481494 if ( _getMarkTypePriority ( current . type ) > _getMarkTypePriority ( highestPriorityMarkTypeSeen ) ) {
482495 highestPriorityMarkTypeSeen = current . type ;
483496 }
@@ -486,7 +499,7 @@ define(function (require, exports, module) {
486499 let line = gutterErrorMessages [ lineno ] [ 0 ] . line ,
487500 ch = gutterErrorMessages [ lineno ] [ 0 ] . ch ,
488501 message = gutterMessage . message ;
489- let marker = _createMarkerElement ( editor , line , ch , highestPriorityMarkTypeSeen , message ) ;
502+ let marker = _createMarkerElement ( editor , line , ch , highestPriorityMarkTypeSeen , message , fixableMarkFound ) ;
490503 editor . setGutterMarker ( line , CODE_INSPECTION_GUTTER , marker ) ;
491504 }
492505 _populateDummyGutterElements ( editor , 0 , editor . getLastVisibleLine ( ) ) ;
@@ -531,15 +544,18 @@ define(function (require, exports, module) {
531544 if ( documentFixes . get ( fixID ) ) {
532545 $problemView = $ ( `<div>
533546 <button class="btn btn-mini primary fix-problem-btn" style="margin-right: 5px;">Fix</button>
534- ${ mark . message } <br/>
547+ <a style="cursor:pointer;">${ mark . message } </a>
548+ <br/>
535549 </div>` ) ;
536550 $problemView . find ( ".fix-problem-btn" ) . click ( ( ) => {
537551 scrollToProblem ( pos . line ) ;
538552 _fixProblem ( fixID ) ;
539553 } ) ;
540554 $hoverMessage . append ( $problemView ) ;
541555 } else {
542- $problemView = $ ( `<div>${ mark . message } <br/></div>` ) ;
556+ $problemView = $ ( `<div>
557+ <a style="cursor: pointer">${ mark . message } </a>
558+ <br/></div>` ) ;
543559 $hoverMessage . append ( $problemView ) ;
544560 }
545561 // eslint-disable-next-line no-loop-func
@@ -615,9 +631,7 @@ define(function (require, exports, module) {
615631 for ( let error of errors ) {
616632 let line = error . pos . line || 0 ;
617633 let ch = error . pos . ch || 0 ;
618- let gutterMessage = gutterErrorMessages [ line ] || [ ] ;
619- gutterMessage . push ( { message : error . message , type : error . type , line, ch} ) ;
620- gutterErrorMessages [ line ] = gutterMessage ;
634+ let fixable = false ;
621635 // add squiggly lines
622636 if ( _shouldMarkTokenAtPosition ( editor , error ) ) {
623637 let mark ;
@@ -626,6 +640,7 @@ define(function (require, exports, module) {
626640 if ( fixID ) {
627641 markOptions . metadata = fixID ;
628642 error . fix . id = fixID ;
643+ fixable = true ;
629644 }
630645 if ( error . endPos && ! editor . isSamePosition ( error . pos , error . endPos ) ) {
631646 mark = editor . markText ( CODE_MARK_TYPE_INSPECTOR , error . pos , error . endPos , markOptions ) ;
@@ -635,6 +650,9 @@ define(function (require, exports, module) {
635650 mark . type = error . type ;
636651 mark . message = error . message ;
637652 }
653+ let gutterMessage = gutterErrorMessages [ line ] || [ ] ;
654+ gutterMessage . push ( { message : error . message , type : error . type , fixable, line, ch} ) ;
655+ gutterErrorMessages [ line ] = gutterMessage ;
638656 }
639657 }
640658 _updateGutterMarks ( editor , gutterErrorMessages ) ;
0 commit comments