@@ -28,6 +28,7 @@ define(function (require, exports, module) {
2828 const FileUtils = require ( "file/FileUtils" ) ;
2929 const CommandManager = require ( "command/CommandManager" ) ;
3030 const Commands = require ( "command/Commands" ) ;
31+ const KeyBindingManager = require ( "command/KeyBindingManager" ) ;
3132 const DocumentManager = require ( "document/DocumentManager" ) ;
3233 const WorkspaceManager = require ( "view/WorkspaceManager" ) ;
3334 const Menus = require ( "command/Menus" ) ;
@@ -515,6 +516,23 @@ define(function (require, exports, module) {
515516 }
516517 } ) ;
517518
519+ // add listener for tab close button to show the tooltip along with the keybinding
520+ $ ( document ) . on ( "mouseenter" , ".phoenix-tab-bar .tab-close" , function ( ) {
521+
522+ // there can be more than 1 keybinding for 'Close' as one is default and other one is user-set
523+ // we need to get the user created keybinding...
524+ const closeBindings = KeyBindingManager . getKeyBindings ( Commands . FILE_CLOSE ) ;
525+ const closeShortcut = closeBindings . length > 0
526+ ? KeyBindingManager . formatKeyDescriptor ( closeBindings [ closeBindings . length - 1 ] . displayKey )
527+ : "" ;
528+
529+ const closeTabTooltip = closeShortcut
530+ ? `${ Strings . CLOSE_TAB_TOOLTIP } (${ closeShortcut } )`
531+ : Strings . CLOSE_TAB_TOOLTIP ;
532+
533+ $ ( this ) . attr ( "title" , closeTabTooltip ) ;
534+ } ) ;
535+
518536 // open tab on mousedown event
519537 $ ( document ) . on ( "mousedown" , ".phoenix-tab-bar .tab" , function ( event ) {
520538 if ( $ ( event . target ) . hasClass ( "fa-times" ) || $ ( event . target ) . closest ( ".tab-close" ) . length ) {
0 commit comments