33 * @typedef {import("./mouse_handler").MouseHandler } MouseHandler
44 */
55var dom = require ( "../lib/dom" ) ;
6- const MouseEvent = require ( "./mouse_event" ) . MouseEvent ;
6+ var MouseEvent = require ( "./mouse_event" ) . MouseEvent ;
77var HoverTooltip = require ( "../tooltip" ) . HoverTooltip ;
88var nls = require ( "../config" ) . nls ;
99var Range = require ( "../range" ) . Range ;
@@ -99,8 +99,10 @@ class GutterTooltip extends HoverTooltip {
9999 super . removeFromEditor ( editor ) ;
100100 }
101101
102- destroy ( editor ) {
103- this . removeFromEditor ( editor ) ;
102+ destroy ( ) {
103+ if ( this . editor ) {
104+ this . removeFromEditor ( this . editor ) ;
105+ }
104106 super . destroy ( ) ;
105107 }
106108
@@ -129,6 +131,9 @@ class GutterTooltip extends HoverTooltip {
129131 } ;
130132 }
131133
134+ /**
135+ * @param {number } row
136+ */
132137 showTooltip ( row ) {
133138 var gutter = this . editor . renderer . $gutterLayer ;
134139 var annotationsInRow = gutter . $annotations [ row ] ;
@@ -149,7 +154,7 @@ class GutterTooltip extends HoverTooltip {
149154 var severityRank = { error : 1 , security : 2 , warning : 3 , info : 4 , hint : 5 } ;
150155 var mostSevereAnnotationTypeInFold ;
151156
152- for ( let i = row + 1 ; i <= fold . end . row ; i ++ ) {
157+ for ( var i = row + 1 ; i <= fold . end . row ; i ++ ) {
153158 if ( ! gutter . $annotations [ i ] ) continue ;
154159
155160 for ( var j = 0 ; j < gutter . $annotations [ i ] . text . length ; j ++ ) {
@@ -181,7 +186,7 @@ class GutterTooltip extends HoverTooltip {
181186 var iconClassName = gutter . $useSvgGutterIcons ? "ace_icon_svg" : "ace_icon" ;
182187
183188 // Construct the contents of the tooltip.
184- for ( let i = 0 ; i < annotation . displayText . length ; i ++ ) {
189+ for ( var i = 0 ; i < annotation . displayText . length ; i ++ ) {
185190 var lineElement = dom . createElement ( "span" ) ;
186191
187192 var iconElement = dom . createElement ( "span" ) ;
@@ -212,26 +217,26 @@ class GutterTooltip extends HoverTooltip {
212217
213218 tooltipElement . setAttribute ( "aria-live" , "polite" ) ;
214219
215- const annotationNode = this . $findLinkedAnnotationNode ( row ) ;
220+ var annotationNode = this . $findLinkedAnnotationNode ( row ) ;
216221 if ( annotationNode ) {
217222 annotationNode . setAttribute ( "aria-describedby" , this . id ) ;
218223 }
219224
220- const range = Range . fromPoints ( { row, column : 0 } , { row, column : 0 } ) ;
225+ var range = Range . fromPoints ( { row, column : 0 } , { row, column : 0 } ) ;
221226 this . showForRange ( this . editor , range , tooltipElement ) ;
222227 this . visibleTooltipRow = row ;
223228 this . editor . _signal ( "showGutterTooltip" , this ) ;
224229 }
225230
226231 $setPosition ( editor , _ignoredPosition , range ) {
227- const gutterCell = this . $findCellByRow ( range . start . row ) ;
232+ var gutterCell = this . $findCellByRow ( range . start . row ) ;
228233 if ( ! gutterCell ) return ;
229- const el = gutterCell && gutterCell . element ;
230- const anchorEl = el && ( el . querySelector ( ".ace_gutter_annotation" ) ) ;
234+ var el = gutterCell && gutterCell . element ;
235+ var anchorEl = el && ( el . querySelector ( ".ace_gutter_annotation" ) ) ;
231236 if ( ! anchorEl ) return ;
232- const r = anchorEl . getBoundingClientRect ( ) ;
237+ var r = anchorEl . getBoundingClientRect ( ) ;
233238 if ( ! r ) return ;
234- const point = {
239+ var point = {
235240 pageX : r . right ,
236241 pageY : r . top
237242 } ;
@@ -246,9 +251,9 @@ class GutterTooltip extends HoverTooltip {
246251 }
247252
248253 $findLinkedAnnotationNode ( row ) {
249- const cell = this . $findCellByRow ( row ) ;
254+ var cell = this . $findCellByRow ( row ) ;
250255 if ( cell ) {
251- const element = cell . element ;
256+ var element = cell . element ;
252257 if ( element . childNodes . length > 2 ) {
253258 return element . childNodes [ 2 ] ;
254259 }
@@ -266,7 +271,7 @@ class GutterTooltip extends HoverTooltip {
266271 this . $element . removeAttribute ( "aria-live" ) ;
267272
268273 if ( this . visibleTooltipRow != undefined ) {
269- const annotationNode = this . $findLinkedAnnotationNode ( this . visibleTooltipRow ) ;
274+ var annotationNode = this . $findLinkedAnnotationNode ( this . visibleTooltipRow ) ;
270275 if ( annotationNode ) {
271276 annotationNode . removeAttribute ( "aria-describedby" ) ;
272277 }
@@ -277,11 +282,11 @@ class GutterTooltip extends HoverTooltip {
277282 }
278283
279284 static annotationsToSummaryString ( annotations ) {
280- const summary = [ ] ;
281- const annotationTypes = [ "error" , "security" , "warning" , "info" , "hint" ] ;
282- for ( const annotationType of annotationTypes ) {
285+ var summary = [ ] ;
286+ var annotationTypes = [ "error" , "security" , "warning" , "info" , "hint" ] ;
287+ for ( var annotationType of annotationTypes ) {
283288 if ( ! annotations [ annotationType ] . length ) continue ;
284- const label = annotations [ annotationType ] . length === 1 ? GutterTooltip . annotationLabels [ annotationType ] . singular : GutterTooltip . annotationLabels [ annotationType ] . plural ;
289+ var label = annotations [ annotationType ] . length === 1 ? GutterTooltip . annotationLabels [ annotationType ] . singular : GutterTooltip . annotationLabels [ annotationType ] . plural ;
285290 summary . push ( `${ annotations [ annotationType ] . length } ${ label } ` ) ;
286291 }
287292 return summary . join ( ", " ) ;
0 commit comments