@@ -49,19 +49,19 @@ export class DataTipManager {
4949 * To optimize show/hide calls we set a timeout of hoverTime for the mouse movement only if the mouse pointer is not
5050 * moving for more than hoverTime the data tip functionality is triggered
5151 */
52- mouseMoveTimer : NodeJS . Timeout | null = null
52+ mouseMoveTimer ?: number
5353
5454 /**
5555 * To optimize show/hide calls we set a timeout of hoverTime for the cursor movement only if the cursor is not moving
5656 * for more than hoverTime the data tip functionality is triggered
5757 */
58- cursorMoveTimer : NodeJS . Timeout | null = null
58+ cursorMoveTimer ?: number
5959
6060 /**
6161 * The time that the mouse/cursor should hover/stay to show a datatip. Also specifies the time that the datatip is
6262 * still shown when the mouse/cursor moves [ms].
6363 */
64- hoverTime = atom . config . get ( "atom-ide-datatip.hoverTime" )
64+ hoverTime = atom . config . get ( "atom-ide-datatip.hoverTime" ) as number
6565
6666 constructor ( ) {
6767 /** The mouse move event handler that evaluates the screen position and eventually shows a data tip */
@@ -207,19 +207,20 @@ export class DataTipManager {
207207 * @param evt The cursor move event
208208 */
209209 onCursorMoveEvt ( event : CursorPositionChangedEvent ) {
210- if ( this . cursorMoveTimer ) {
210+ if ( this . cursorMoveTimer !== undefined ) {
211211 clearTimeout ( this . cursorMoveTimer )
212212 }
213213
214214 this . cursorMoveTimer = setTimeout (
215- ( evt ) => {
215+ async ( evt : CursorPositionChangedEvent ) => {
216216 if ( evt . textChanged || ! this . showDataTipOnCursorMove ) {
217217 return
218218 }
219- const editor = evt . cursor . editor
219+ // @ts -ignore internal API
220+ const editor = evt . cursor . editor as TextEditor
220221 const position = evt . cursor . getBufferPosition ( )
221222 if ( this . currentMarkerRange === null || ! this . currentMarkerRange . containsPoint ( position ) ) {
222- this . showDataTip ( editor , position )
223+ await this . showDataTip ( editor , position )
223224 }
224225 } ,
225226 this . hoverTime ,
@@ -229,12 +230,12 @@ export class DataTipManager {
229230
230231 /** The central mouse movement event handler */
231232 onMouseMoveEvt ( event : MouseEvent ) {
232- if ( this . mouseMoveTimer ) {
233+ if ( this . mouseMoveTimer !== undefined ) {
233234 clearTimeout ( this . mouseMoveTimer )
234235 }
235236
236237 this . mouseMoveTimer = setTimeout (
237- ( evt ) => {
238+ async ( evt : MouseEvent ) => {
238239 if ( this . editorView === null || this . editor === null ) {
239240 return
240241 }
@@ -262,7 +263,7 @@ export class DataTipManager {
262263
263264 const point = this . editor . bufferPositionForScreenPosition ( screenPosition )
264265 if ( this . currentMarkerRange === null || ! this . currentMarkerRange . containsPoint ( point ) ) {
265- this . showDataTip ( this . editor , point )
266+ await this . showDataTip ( this . editor , point )
266267 }
267268 } ,
268269 this . hoverTime ,
@@ -275,18 +276,18 @@ export class DataTipManager {
275276 *
276277 * @param evt Command event
277278 */
278- onCommandEvt ( evt : CommandEvent < TextEditorElement > ) {
279+ async onCommandEvt ( evt : CommandEvent < TextEditorElement > ) {
279280 const editor = evt . currentTarget . getModel ( )
280281
281282 if ( atom . workspace . isTextEditor ( editor ) ) {
282283 const position = evt . currentTarget . getModel ( ) . getCursorBufferPosition ( )
283284
284285 const isTooltipOpenForPosition = this . currentMarkerRange ?. containsPoint ( position )
285- if ( isTooltipOpenForPosition ) {
286+ if ( isTooltipOpenForPosition === true ) {
286287 return this . unmountDataTip ( )
287288 }
288289
289- this . showDataTip ( editor , position )
290+ await this . showDataTip ( editor , position )
290291 }
291292 }
292293
@@ -352,6 +353,7 @@ export class DataTipManager {
352353 for ( const markedString of datatip . markedStrings ) {
353354 if ( markedString . type === "snippet" ) {
354355 snippetData . push ( markedString . value )
356+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
355357 } else if ( markedString . type === "markdown" ) {
356358 markdownData . push ( markedString . value )
357359 }
0 commit comments