@@ -40,11 +40,13 @@ import { getColorClass, getUriClasses } from 'vs/workbench/contrib/terminal/brow
40
40
import { withNullAsUndefined } from 'vs/base/common/types' ;
41
41
import { getTerminalActionBarArgs } from 'vs/workbench/contrib/terminal/browser/terminalMenus' ;
42
42
import { TerminalContextKeys } from 'vs/workbench/contrib/terminal/common/terminalContextKey' ;
43
- import { getShellIntegrationTooltip , getShellProcessTooltip } from 'vs/workbench/contrib/terminal/browser/terminalTooltip' ;
43
+ import { getInstanceHoverInfo } from 'vs/workbench/contrib/terminal/browser/terminalTooltip' ;
44
44
import { ServicesAccessor } from 'vs/editor/browser/editorExtensions' ;
45
45
import { TerminalCapability } from 'vs/platform/terminal/common/capabilities/capabilities' ;
46
46
import { defaultSelectBoxStyles } from 'vs/platform/theme/browser/defaultStyles' ;
47
47
import { Event } from 'vs/base/common/event' ;
48
+ import { IHoverDelegate , IHoverDelegateOptions } from 'vs/base/browser/ui/iconLabel/iconHoverDelegate' ;
49
+ import { IHoverService } from 'vs/workbench/services/hover/browser/hover' ;
48
50
49
51
export class TerminalViewPane extends ViewPane {
50
52
private _fontStyleElement : HTMLElement | undefined ;
@@ -351,7 +353,10 @@ class SingleTerminalTabActionViewItem extends MenuEntryActionViewItem {
351
353
@ICommandService private readonly _commandService : ICommandService ,
352
354
@IInstantiationService private readonly _instantiationService : IInstantiationService ,
353
355
) {
354
- super ( action , { draggable : true } , keybindingService , notificationService , contextKeyService , themeService , contextMenuService ) ;
356
+ super ( action , {
357
+ draggable : true ,
358
+ hoverDelegate : _instantiationService . createInstance ( SingleTabHoverDelegate )
359
+ } , keybindingService , notificationService , contextKeyService , themeService , contextMenuService ) ;
355
360
356
361
// Register listeners to update the tab
357
362
this . _register ( Event . debounce < ITerminalInstance | undefined , Set < ITerminalInstance > > ( Event . any (
@@ -468,7 +473,6 @@ class SingleTerminalTabActionViewItem extends MenuEntryActionViewItem {
468
473
this . _altCommand = `alt-command` ;
469
474
label . classList . add ( this . _altCommand ) ;
470
475
}
471
- this . _action . tooltip = getSingleTabTooltip ( instance , this . _terminalService . configHelper . config . tabs . separator ) ;
472
476
this . updateTooltip ( ) ;
473
477
}
474
478
}
@@ -498,16 +502,6 @@ function getSingleTabLabel(accessor: ServicesAccessor, instance: ITerminalInstan
498
502
return `${ label } $(${ primaryStatus . icon . id } )` ;
499
503
}
500
504
501
- function getSingleTabTooltip ( instance : ITerminalInstance | undefined , separator : string ) : string {
502
- if ( ! instance ) {
503
- return '' ;
504
- }
505
- const parts : string [ ] = [ ] ;
506
- parts . push ( getSingleTabTitle ( instance , separator ) + getShellProcessTooltip ( instance , false ) + getShellIntegrationTooltip ( instance , false ) ) ;
507
- parts . push ( instance . statusList . primary ?. tooltip || '' ) ;
508
- return parts . filter ( e => e ) . join ( '\n\n' ) ;
509
- }
510
-
511
505
function getSingleTabTitle ( instance : ITerminalInstance | undefined , separator : string ) : string {
512
506
if ( ! instance ) {
513
507
return '' ;
@@ -585,3 +579,39 @@ class TerminalThemeIconStyle extends Themable {
585
579
this . _styleElement . textContent = css ;
586
580
}
587
581
}
582
+
583
+ class SingleTabHoverDelegate implements IHoverDelegate {
584
+ private _lastHoverHideTime : number = 0 ;
585
+
586
+ readonly placement = 'element' ;
587
+
588
+ constructor (
589
+ @IConfigurationService private readonly _configurationService : IConfigurationService ,
590
+ @IHoverService private readonly _hoverService : IHoverService ,
591
+ @ITerminalGroupService private readonly _terminalGroupService : ITerminalGroupService
592
+ ) {
593
+ }
594
+
595
+ get delay ( ) : number {
596
+ return Date . now ( ) - this . _lastHoverHideTime < 200
597
+ ? 0 // show instantly when a hover was recently shown
598
+ : this . _configurationService . getValue < number > ( 'workbench.hover.delay' ) ;
599
+ }
600
+
601
+ showHover ( options : IHoverDelegateOptions , focus ?: boolean ) {
602
+ const instance = this . _terminalGroupService . activeInstance ;
603
+ if ( ! instance ) {
604
+ return ;
605
+ }
606
+ const hoverInfo = getInstanceHoverInfo ( instance ) ;
607
+ return this . _hoverService . showHover ( {
608
+ ...options ,
609
+ content : hoverInfo . content ,
610
+ actions : hoverInfo . actions
611
+ } , focus ) ;
612
+ }
613
+
614
+ onDidHideHover ( ) {
615
+ this . _lastHoverHideTime = Date . now ( ) ;
616
+ }
617
+ }
0 commit comments