@@ -49,19 +49,19 @@ export class DataTipManager {
49
49
* To optimize show/hide calls we set a timeout of hoverTime for the mouse movement only if the mouse pointer is not
50
50
* moving for more than hoverTime the data tip functionality is triggered
51
51
*/
52
- mouseMoveTimer : NodeJS . Timeout | null = null
52
+ mouseMoveTimer ?: number
53
53
54
54
/**
55
55
* To optimize show/hide calls we set a timeout of hoverTime for the cursor movement only if the cursor is not moving
56
56
* for more than hoverTime the data tip functionality is triggered
57
57
*/
58
- cursorMoveTimer : NodeJS . Timeout | null = null
58
+ cursorMoveTimer ?: number
59
59
60
60
/**
61
61
* The time that the mouse/cursor should hover/stay to show a datatip. Also specifies the time that the datatip is
62
62
* still shown when the mouse/cursor moves [ms].
63
63
*/
64
- hoverTime = atom . config . get ( "atom-ide-datatip.hoverTime" )
64
+ hoverTime = atom . config . get ( "atom-ide-datatip.hoverTime" ) as number
65
65
66
66
constructor ( ) {
67
67
/** The mouse move event handler that evaluates the screen position and eventually shows a data tip */
@@ -207,19 +207,20 @@ export class DataTipManager {
207
207
* @param evt The cursor move event
208
208
*/
209
209
onCursorMoveEvt ( event : CursorPositionChangedEvent ) {
210
- if ( this . cursorMoveTimer ) {
210
+ if ( this . cursorMoveTimer !== undefined ) {
211
211
clearTimeout ( this . cursorMoveTimer )
212
212
}
213
213
214
214
this . cursorMoveTimer = setTimeout (
215
- ( evt ) => {
215
+ async ( evt : CursorPositionChangedEvent ) => {
216
216
if ( evt . textChanged || ! this . showDataTipOnCursorMove ) {
217
217
return
218
218
}
219
- const editor = evt . cursor . editor
219
+ // @ts -ignore internal API
220
+ const editor = evt . cursor . editor as TextEditor
220
221
const position = evt . cursor . getBufferPosition ( )
221
222
if ( this . currentMarkerRange === null || ! this . currentMarkerRange . containsPoint ( position ) ) {
222
- this . showDataTip ( editor , position )
223
+ await this . showDataTip ( editor , position )
223
224
}
224
225
} ,
225
226
this . hoverTime ,
@@ -229,12 +230,12 @@ export class DataTipManager {
229
230
230
231
/** The central mouse movement event handler */
231
232
onMouseMoveEvt ( event : MouseEvent ) {
232
- if ( this . mouseMoveTimer ) {
233
+ if ( this . mouseMoveTimer !== undefined ) {
233
234
clearTimeout ( this . mouseMoveTimer )
234
235
}
235
236
236
237
this . mouseMoveTimer = setTimeout (
237
- ( evt ) => {
238
+ async ( evt : MouseEvent ) => {
238
239
if ( this . editorView === null || this . editor === null ) {
239
240
return
240
241
}
@@ -262,7 +263,7 @@ export class DataTipManager {
262
263
263
264
const point = this . editor . bufferPositionForScreenPosition ( screenPosition )
264
265
if ( this . currentMarkerRange === null || ! this . currentMarkerRange . containsPoint ( point ) ) {
265
- this . showDataTip ( this . editor , point )
266
+ await this . showDataTip ( this . editor , point )
266
267
}
267
268
} ,
268
269
this . hoverTime ,
@@ -275,18 +276,18 @@ export class DataTipManager {
275
276
*
276
277
* @param evt Command event
277
278
*/
278
- onCommandEvt ( evt : CommandEvent < TextEditorElement > ) {
279
+ async onCommandEvt ( evt : CommandEvent < TextEditorElement > ) {
279
280
const editor = evt . currentTarget . getModel ( )
280
281
281
282
if ( atom . workspace . isTextEditor ( editor ) ) {
282
283
const position = evt . currentTarget . getModel ( ) . getCursorBufferPosition ( )
283
284
284
285
const isTooltipOpenForPosition = this . currentMarkerRange ?. containsPoint ( position )
285
- if ( isTooltipOpenForPosition ) {
286
+ if ( isTooltipOpenForPosition === true ) {
286
287
return this . unmountDataTip ( )
287
288
}
288
289
289
- this . showDataTip ( editor , position )
290
+ await this . showDataTip ( editor , position )
290
291
}
291
292
}
292
293
@@ -352,6 +353,7 @@ export class DataTipManager {
352
353
for ( const markedString of datatip . markedStrings ) {
353
354
if ( markedString . type === "snippet" ) {
354
355
snippetData . push ( markedString . value )
356
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
355
357
} else if ( markedString . type === "markdown" ) {
356
358
markdownData . push ( markedString . value )
357
359
}
0 commit comments