@@ -143,6 +143,10 @@ export class HoverCM extends CodeMirrorIntegration {
143
143
return this . settings . composite . modifierKey ;
144
144
}
145
145
146
+ protected get isHoverAutomatic ( ) : boolean {
147
+ return this . settings . composite . autoActivate ;
148
+ }
149
+
146
150
get lab_integration ( ) {
147
151
return super . lab_integration as HoverLabIntegration ;
148
152
}
@@ -390,7 +394,8 @@ export class HoverCM extends CodeMirrorIntegration {
390
394
return false ;
391
395
}
392
396
393
- const show_tooltip = getModifierState ( event , this . modifierKey ) ;
397
+ const show_tooltip =
398
+ this . isHoverAutomatic || getModifierState ( event , this . modifierKey ) ;
394
399
395
400
// currently the events are coming from notebook panel; ideally these would be connected to individual cells,
396
401
// (only cells with code) instead, but this is more complex to implement right. In any case filtering
@@ -440,6 +445,7 @@ export class HoverCM extends CodeMirrorIntegration {
440
445
] ) ;
441
446
}
442
447
let response_data = this . restore_from_cache ( document , virtual_position ) ;
448
+ let delay_ms = this . settings . composite . delay ;
443
449
444
450
if ( response_data == null ) {
445
451
const promise = this . debounced_get_hover . invoke ( ) ;
@@ -473,12 +479,21 @@ export class HoverCM extends CodeMirrorIntegration {
473
479
} ;
474
480
475
481
this . cache . store ( response_data ) ;
482
+ delay_ms = Math . max (
483
+ 0 ,
484
+ this . settings . composite . delay -
485
+ this . settings . composite . throttlerDelay
486
+ ) ;
476
487
} else {
477
488
this . remove_range_highlight ( ) ;
478
489
return false ;
479
490
}
480
491
}
481
492
493
+ if ( this . isHoverAutomatic ) {
494
+ await new Promise ( resolve => setTimeout ( resolve , delay_ms ) ) ;
495
+ }
496
+
482
497
return this . handleResponse ( response_data , root_position , show_tooltip ) ;
483
498
} else {
484
499
return true ;
0 commit comments