6
6
import * as dom from 'vs/base/browser/dom' ;
7
7
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent' ;
8
8
import * as aria from 'vs/base/browser/ui/aria/aria' ;
9
+ import { IUpdatableHover } from 'vs/base/browser/ui/hover/hover' ;
10
+ import { getBaseLayerHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegate2' ;
11
+ import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory' ;
9
12
import { renderIcon } from 'vs/base/browser/ui/iconLabel/iconLabels' ;
10
13
import { IListRenderer , IListVirtualDelegate } from 'vs/base/browser/ui/list/list' ;
11
14
import { List } from 'vs/base/browser/ui/list/listWidget' ;
@@ -28,6 +31,7 @@ import { Position } from 'vs/editor/common/core/position';
28
31
import { IRange , Range } from 'vs/editor/common/core/range' ;
29
32
import { ScrollType } from 'vs/editor/common/editorCommon' ;
30
33
import { NewSymbolName , NewSymbolNameTag , NewSymbolNameTriggerKind , ProviderResult } from 'vs/editor/common/languages' ;
34
+ import * as nls from 'vs/nls' ;
31
35
import { localize } from 'vs/nls' ;
32
36
import { IContextKey , IContextKeyService , RawContextKey } from 'vs/platform/contextkey/common/contextkey' ;
33
37
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding' ;
@@ -869,6 +873,9 @@ class InputWithButton implements IDisposable {
869
873
private _domNode : HTMLDivElement | undefined ;
870
874
private _inputNode : HTMLInputElement | undefined ;
871
875
private _buttonNode : HTMLElement | undefined ;
876
+ private _buttonHover : IUpdatableHover | undefined ;
877
+ private _buttonGenHoverText : string | undefined ;
878
+ private _buttonCancelHoverText : string | undefined ;
872
879
private _sparkleIcon : HTMLElement | undefined ;
873
880
private _stopIcon : HTMLElement | undefined ;
874
881
@@ -903,6 +910,11 @@ class InputWithButton implements IDisposable {
903
910
this . _buttonNode . style . borderRadius = '5px' ;
904
911
this . _buttonNode . setAttribute ( 'tabindex' , '0' ) ;
905
912
913
+ this . _buttonGenHoverText = nls . localize ( 'generateRenameSuggestionsButton' , "Generate new name suggestions" ) ;
914
+ this . _buttonCancelHoverText = nls . localize ( 'cancelRenameSuggestionsButton' , "Cancel" ) ;
915
+ this . _buttonHover = getBaseLayerHoverDelegate ( ) . setupUpdatableHover ( getDefaultHoverDelegate ( 'element' ) , this . _buttonNode , this . _buttonGenHoverText ) ;
916
+ this . _disposables . add ( this . _buttonHover ) ;
917
+
906
918
this . _domNode . appendChild ( this . _buttonNode ) ;
907
919
908
920
// notify if selection changes to cancel request to rename-suggestion providers
@@ -950,6 +962,8 @@ class InputWithButton implements IDisposable {
950
962
this . _sparkleIcon ??= renderIcon ( Codicon . sparkle ) ;
951
963
dom . clearNode ( this . button ) ;
952
964
this . button . appendChild ( this . _sparkleIcon ) ;
965
+ this . button . setAttribute ( 'aria-label' , 'Generating new name suggestions' ) ;
966
+ this . _buttonHover ?. update ( this . _buttonGenHoverText ) ;
953
967
this . input . focus ( ) ;
954
968
}
955
969
@@ -958,6 +972,8 @@ class InputWithButton implements IDisposable {
958
972
this . _stopIcon ??= renderIcon ( Codicon . primitiveSquare ) ;
959
973
dom . clearNode ( this . button ) ;
960
974
this . button . appendChild ( this . _stopIcon ) ;
975
+ this . button . setAttribute ( 'aria-label' , 'Cancel generating new name suggestions' ) ;
976
+ this . _buttonHover ?. update ( this . _buttonCancelHoverText ) ;
961
977
this . input . focus ( ) ;
962
978
}
963
979
0 commit comments