@@ -14,86 +14,63 @@ import { ProviderRegistry } from "atom-ide-base/commons-atom/ProviderRegistry"
14
14
import { makeOverlaySelectable } from "atom-ide-base/commons-ui/float-pane/selectable-overlay"
15
15
16
16
export class DataTipManager {
17
- /**
18
- * holds a reference to disposable items from this data tip manager
19
- */
17
+ /** Holds a reference to disposable items from this data tip manager */
20
18
subscriptions : CompositeDisposable = new CompositeDisposable ( )
21
19
22
- /**
23
- * holds a list of registered data tip providers
24
- */
20
+ /** Holds a list of registered data tip providers */
25
21
providerRegistry : ProviderRegistry < DatatipProvider > = new ProviderRegistry ( )
26
22
27
- /**
28
- * holds a weak reference to all watched Atom text editors
29
- */
23
+ /** Holds a weak reference to all watched Atom text editors */
30
24
watchedEditors : WeakSet < TextEditor > = new WeakSet ( )
31
25
32
- /**
33
- * holds a reference to the current watched Atom text editor
34
- */
26
+ /** Holds a reference to the current watched Atom text editor */
35
27
editor : TextEditor | null = null
36
28
37
- /**
38
- * holds a reference to the current watched Atom text editor viewbuffer
39
- */
29
+ /** Holds a reference to the current watched Atom text editor viewbuffer */
40
30
editorView : TextEditorElement | null = null
41
31
42
- /**
43
- * holds a reference to all disposable items for the current watched Atom text editor
44
- */
32
+ /** Holds a reference to all disposable items for the current watched Atom text editor */
45
33
editorSubscriptions : CompositeDisposable | null = null
46
34
47
- /**
48
- * holds a reference to all disposable items for the current data tip
49
- */
35
+ /** Holds a reference to all disposable items for the current data tip */
50
36
dataTipMarkerDisposables : CompositeDisposable | null = null
51
37
52
- /**
53
- * config flag denoting if the data tip should be shown when moving the cursor on screen
54
- */
38
+ /** Config flag denoting if the data tip should be shown when moving the cursor on screen */
55
39
showDataTipOnCursorMove = false
56
40
57
- /**
58
- * config flag denoting if the data tip should be shown when moving the mouse cursor around
59
- */
41
+ /** Config flag denoting if the data tip should be shown when moving the mouse cursor around */
60
42
showDataTipOnMouseMove = true
61
43
62
- /**
63
- * holds the range of the current data tip to prevent unnecessary show/hide calls
64
- */
44
+ /** Holds the range of the current data tip to prevent unnecessary show/hide calls */
65
45
currentMarkerRange : Range | null = null
66
46
67
47
/**
68
- * to optimize show/hide calls we set a timeout of hoverTime for the mouse movement
69
- * only if the mouse pointer is not moving for more than hoverTime the data tip functionality is triggered
48
+ * To optimize show/hide calls we set a timeout of hoverTime for the mouse movement only if the mouse pointer is not
49
+ * moving for more than hoverTime the data tip functionality is triggered
70
50
*/
71
51
mouseMoveTimer : NodeJS . Timeout | null = null
72
52
73
53
/**
74
- * to optimize show/hide calls we set a timeout of hoverTime for the cursor movement
75
- * only if the cursor is not moving for more than hoverTime the data tip functionality is triggered
54
+ * To optimize show/hide calls we set a timeout of hoverTime for the cursor movement only if the cursor is not moving
55
+ * for more than hoverTime the data tip functionality is triggered
76
56
*/
77
57
cursorMoveTimer : NodeJS . Timeout | null = null
78
58
79
- /** The time that the mouse/cursor should hover/stay to show a datatip. Also specifies the time that the datatip is still shown when the mouse/cursor moves [ms]. */
59
+ /**
60
+ * The time that the mouse/cursor should hover/stay to show a datatip. Also specifies the time that the datatip is
61
+ * still shown when the mouse/cursor moves [ms].
62
+ */
80
63
hoverTime = atom . config . get ( "atom-ide-datatip.hoverTime" )
81
64
82
65
constructor ( ) {
83
- /**
84
- * the mouse move event handler that evaluates the screen position and eventually shows a data tip
85
- */
66
+ /** The mouse move event handler that evaluates the screen position and eventually shows a data tip */
86
67
this . onMouseMoveEvt = this . onMouseMoveEvt . bind ( this )
87
68
88
- /**
89
- * the cursor move event handler that evaluates the cursor position and eventually shows a data tip
90
- */
69
+ /** The cursor move event handler that evaluates the cursor position and eventually shows a data tip */
91
70
this . onCursorMoveEvt = this . onCursorMoveEvt . bind ( this )
92
71
}
93
72
94
- /**
95
- * initialization routine retrieving a reference to the markdown service
96
- */
73
+ /** Initialization routine retrieving a reference to the markdown service */
97
74
initialize ( ) {
98
75
this . subscriptions . add (
99
76
atom . workspace . observeTextEditors ( ( editor ) => {
@@ -120,9 +97,7 @@ export class DataTipManager {
120
97
)
121
98
}
122
99
123
- /**
124
- * dispose function to clean up any disposable references used
125
- */
100
+ /** Dispose function to clean up any disposable references used */
126
101
dispose ( ) {
127
102
if ( this . dataTipMarkerDisposables ) {
128
103
this . dataTipMarkerDisposables . dispose ( )
@@ -139,16 +114,15 @@ export class DataTipManager {
139
114
}
140
115
}
141
116
142
- /**
143
- * returns the provider registry as a consumable service
144
- */
117
+ /** Returns the provider registry as a consumable service */
145
118
get datatipService ( ) {
146
119
return this . providerRegistry
147
120
}
148
121
149
122
/**
150
- * checks and setups an Atom Text editor instance for tracking cursor/mouse movements
151
- * @param editor a valid Atom Text editor instance
123
+ * Checks and setups an Atom Text editor instance for tracking cursor/mouse movements
124
+ *
125
+ * @param editor A valid Atom Text editor instance
152
126
*/
153
127
watchEditor ( editor : TextEditor ) {
154
128
if ( this . watchedEditors . has ( editor ) ) {
@@ -182,9 +156,9 @@ export class DataTipManager {
182
156
}
183
157
184
158
/**
185
- * updates the internal references to a specific Atom Text editor instance in case
186
- * it has been decided to track this instance
187
- * @param editor the Atom Text editor instance to be tracked
159
+ * Updates the internal references to a specific Atom Text editor instance in case it has been decided to track this instance
160
+ *
161
+ * @param editor The Atom Text editor instance to be tracked
188
162
*/
189
163
updateCurrentEditor ( editor : TextEditor | null ) {
190
164
if ( editor === this . editor ) {
@@ -229,8 +203,9 @@ export class DataTipManager {
229
203
}
230
204
231
205
/**
232
- * the central cursor movement event handler
233
- * @param evt the cursor move event
206
+ * The central cursor movement event handler
207
+ *
208
+ * @param evt The cursor move event
234
209
*/
235
210
onCursorMoveEvt ( event : CursorPositionChangedEvent ) {
236
211
if ( this . cursorMoveTimer ) {
@@ -253,9 +228,7 @@ export class DataTipManager {
253
228
)
254
229
}
255
230
256
- /**
257
- * the central mouse movement event handler
258
- */
231
+ /** The central mouse movement event handler */
259
232
onMouseMoveEvt ( event : MouseEvent ) {
260
233
if ( this . mouseMoveTimer ) {
261
234
clearTimeout ( this . mouseMoveTimer )
@@ -299,8 +272,9 @@ export class DataTipManager {
299
272
}
300
273
301
274
/**
302
- * the central command event handler
303
- * @param evt command event
275
+ * The central command event handler
276
+ *
277
+ * @param evt Command event
304
278
*/
305
279
onCommandEvt ( evt : CommandEvent < TextEditorElement > ) {
306
280
const editor = evt . currentTarget . getModel ( )
@@ -318,11 +292,12 @@ export class DataTipManager {
318
292
}
319
293
320
294
/**
321
- * evaluates the responsible DatatipProvider to call for data tip information at a given position in a specific Atom Text editor
322
- * @param editor the Atom Text editor instance to be used
323
- * @param position the cursor or mouse position within the text editor to qualify for a data tip
324
- * @param evt the original event triggering this data tip evaluation
325
- * @return a promise object to track the asynchronous operation
295
+ * Evaluates the responsible DatatipProvider to call for data tip information at a given position in a specific Atom Text editor
296
+ *
297
+ * @param editor The Atom Text editor instance to be used
298
+ * @param position The cursor or mouse position within the text editor to qualify for a data tip
299
+ * @param evt The original event triggering this data tip evaluation
300
+ * @returns A promise object to track the asynchronous operation
326
301
*/
327
302
async showDataTip ( editor : TextEditor , position : Point ) : Promise < void > {
328
303
try {
@@ -412,12 +387,13 @@ export class DataTipManager {
412
387
}
413
388
414
389
/**
415
- * mounts / displays a data tip view component at a specific position in a given Atom Text editor
416
- * @param editor the Atom Text editor instance to host the data tip view
417
- * @param range the range for which the data tip component is valid
418
- * @param position the position on which to show the data tip view
419
- * @param view the data tip component to display
420
- * @return a composite object to release references at a later stage
390
+ * Mounts / displays a data tip view component at a specific position in a given Atom Text editor
391
+ *
392
+ * @param editor The Atom Text editor instance to host the data tip view
393
+ * @param range The range for which the data tip component is valid
394
+ * @param position The position on which to show the data tip view
395
+ * @param view The data tip component to display
396
+ * @returns A composite object to release references at a later stage
421
397
*/
422
398
mountDataTipWithMarker (
423
399
editor : TextEditor ,
@@ -497,9 +473,7 @@ export class DataTipManager {
497
473
return disposables
498
474
}
499
475
500
- /**
501
- * unmounts / hides the most recent data tip view component
502
- */
476
+ /** Unmounts / hides the most recent data tip view component */
503
477
unmountDataTip ( ) {
504
478
this . currentMarkerRange = null
505
479
this . dataTipMarkerDisposables ?. dispose ( )
@@ -508,8 +482,9 @@ export class DataTipManager {
508
482
}
509
483
510
484
/**
511
- * handles the mouse wheel event to enable scrolling over long text
512
- * @param evt the mouse wheel event being triggered
485
+ * Handles the mouse wheel event to enable scrolling over long text
486
+ *
487
+ * @param evt The mouse wheel event being triggered
513
488
*/
514
489
function onMouseWheel ( evt : WheelEvent ) {
515
490
evt . stopPropagation ( )
0 commit comments