@@ -40,11 +40,13 @@ import { getColorClass, getUriClasses } from 'vs/workbench/contrib/terminal/brow
4040import { withNullAsUndefined } from 'vs/base/common/types' ;
4141import { getTerminalActionBarArgs } from 'vs/workbench/contrib/terminal/browser/terminalMenus' ;
4242import { 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' ;
4444import { ServicesAccessor } from 'vs/editor/browser/editorExtensions' ;
4545import { TerminalCapability } from 'vs/platform/terminal/common/capabilities/capabilities' ;
4646import { defaultSelectBoxStyles } from 'vs/platform/theme/browser/defaultStyles' ;
4747import { 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' ;
4850
4951export class TerminalViewPane extends ViewPane {
5052 private _fontStyleElement : HTMLElement | undefined ;
@@ -351,7 +353,10 @@ class SingleTerminalTabActionViewItem extends MenuEntryActionViewItem {
351353 @ICommandService private readonly _commandService : ICommandService ,
352354 @IInstantiationService private readonly _instantiationService : IInstantiationService ,
353355 ) {
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 ) ;
355360
356361 // Register listeners to update the tab
357362 this . _register ( Event . debounce < ITerminalInstance | undefined , Set < ITerminalInstance > > ( Event . any (
@@ -468,7 +473,6 @@ class SingleTerminalTabActionViewItem extends MenuEntryActionViewItem {
468473 this . _altCommand = `alt-command` ;
469474 label . classList . add ( this . _altCommand ) ;
470475 }
471- this . _action . tooltip = getSingleTabTooltip ( instance , this . _terminalService . configHelper . config . tabs . separator ) ;
472476 this . updateTooltip ( ) ;
473477 }
474478 }
@@ -498,16 +502,6 @@ function getSingleTabLabel(accessor: ServicesAccessor, instance: ITerminalInstan
498502 return `${ label } $(${ primaryStatus . icon . id } )` ;
499503}
500504
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-
511505function getSingleTabTitle ( instance : ITerminalInstance | undefined , separator : string ) : string {
512506 if ( ! instance ) {
513507 return '' ;
@@ -585,3 +579,39 @@ class TerminalThemeIconStyle extends Themable {
585579 this . _styleElement . textContent = css ;
586580 }
587581}
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