@@ -143,6 +143,10 @@ export class HoverCM extends CodeMirrorIntegration {
143143 return this . settings . composite . modifierKey ;
144144 }
145145
146+ protected get isHoverAutomatic ( ) : boolean {
147+ return this . settings . composite . autoActivate ;
148+ }
149+
146150 get lab_integration ( ) {
147151 return super . lab_integration as HoverLabIntegration ;
148152 }
@@ -390,7 +394,8 @@ export class HoverCM extends CodeMirrorIntegration {
390394 return false ;
391395 }
392396
393- const show_tooltip = getModifierState ( event , this . modifierKey ) ;
397+ const show_tooltip =
398+ this . isHoverAutomatic || getModifierState ( event , this . modifierKey ) ;
394399
395400 // currently the events are coming from notebook panel; ideally these would be connected to individual cells,
396401 // (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 {
440445 ] ) ;
441446 }
442447 let response_data = this . restore_from_cache ( document , virtual_position ) ;
448+ let delay_ms = this . settings . composite . delay ;
443449
444450 if ( response_data == null ) {
445451 const promise = this . debounced_get_hover . invoke ( ) ;
@@ -473,12 +479,21 @@ export class HoverCM extends CodeMirrorIntegration {
473479 } ;
474480
475481 this . cache . store ( response_data ) ;
482+ delay_ms = Math . max (
483+ 0 ,
484+ this . settings . composite . delay -
485+ this . settings . composite . throttlerDelay
486+ ) ;
476487 } else {
477488 this . remove_range_highlight ( ) ;
478489 return false ;
479490 }
480491 }
481492
493+ if ( this . isHoverAutomatic ) {
494+ await new Promise ( resolve => setTimeout ( resolve , delay_ms ) ) ;
495+ }
496+
482497 return this . handleResponse ( response_data , root_position , show_tooltip ) ;
483498 } else {
484499 return true ;
0 commit comments