@@ -11,14 +11,16 @@ import { IContextViewService } from 'vs/platform/contextview/browser/contextView
11
11
import { IHoverService } from 'vs/platform/hover/browser/hover' ;
12
12
import { IInstantiationService , ServicesAccessor } from 'vs/platform/instantiation/common/instantiation' ;
13
13
import { HoverVerbosityAction } from 'vs/editor/common/languages' ;
14
- import { DECREASE_HOVER_VERBOSITY_ACCESSIBLE_ACTION_ID , DECREASE_HOVER_VERBOSITY_ACTION_ID , DECREASE_HOVER_VERBOSITY_ACTION_LABEL , INCREASE_HOVER_VERBOSITY_ACCESSIBLE_ACTION_ID , INCREASE_HOVER_VERBOSITY_ACTION_ID , INCREASE_HOVER_VERBOSITY_ACTION_LABEL } from 'vs/editor/contrib/hover/browser/hoverActionIds' ;
14
+ import { DECREASE_HOVER_VERBOSITY_ACCESSIBLE_ACTION_ID , DECREASE_HOVER_VERBOSITY_ACTION_ID , INCREASE_HOVER_VERBOSITY_ACCESSIBLE_ACTION_ID , INCREASE_HOVER_VERBOSITY_ACTION_ID } from 'vs/editor/contrib/hover/browser/hoverActionIds' ;
15
15
import { ICodeEditor } from 'vs/editor/browser/editorBrowser' ;
16
16
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService' ;
17
17
import { Action , IAction } from 'vs/base/common/actions' ;
18
18
import { ThemeIcon } from 'vs/base/common/themables' ;
19
19
import { Codicon } from 'vs/base/common/codicons' ;
20
20
import { Emitter , Event } from 'vs/base/common/event' ;
21
21
import { Disposable , IDisposable } from 'vs/base/common/lifecycle' ;
22
+ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding' ;
23
+ import { labelForHoverVerbosityAction } from 'vs/editor/contrib/hover/browser/markdownHoverParticipant' ;
22
24
23
25
namespace HoverAccessibilityHelpNLS {
24
26
export const intro = localize ( 'intro' , "Focus on the hover widget to cycle through the hover parts with the Tab key." ) ;
@@ -46,7 +48,8 @@ export class HoverAccessibleView implements IAccessibleViewImplentation {
46
48
if ( ! hoverController ) {
47
49
return ;
48
50
}
49
- this . _provider = accessor . get ( IInstantiationService ) . createInstance ( HoverAccessibleViewProvider , codeEditor , hoverController ) ;
51
+ const keybindingService = accessor . get ( IKeybindingService ) ;
52
+ this . _provider = accessor . get ( IInstantiationService ) . createInstance ( HoverAccessibleViewProvider , keybindingService , codeEditor , hoverController ) ;
50
53
return this . _provider ;
51
54
}
52
55
@@ -125,7 +128,6 @@ abstract class BaseHoverAccessibleViewProvider extends Disposable implements IAc
125
128
}
126
129
}
127
130
128
-
129
131
export class HoverAccessibilityHelpProvider extends BaseHoverAccessibleViewProvider implements IAccessibleViewContentProvider {
130
132
131
133
public readonly options : IAccessibleViewOptions = { type : AccessibleViewType . Help } ;
@@ -190,6 +192,7 @@ export class HoverAccessibleViewProvider extends BaseHoverAccessibleViewProvider
190
192
public readonly options : IAccessibleViewOptions = { type : AccessibleViewType . View } ;
191
193
192
194
constructor (
195
+ private readonly _keybindingService : IKeybindingService ,
193
196
private readonly _editor : ICodeEditor ,
194
197
hoverController : HoverController ,
195
198
) {
@@ -212,22 +215,20 @@ export class HoverAccessibleViewProvider extends BaseHoverAccessibleViewProvider
212
215
private _getActionFor ( editor : ICodeEditor , action : HoverVerbosityAction ) : IAction {
213
216
let actionId : string ;
214
217
let accessibleActionId : string ;
215
- let actionLabel : string ;
216
218
let actionCodicon : ThemeIcon ;
217
219
switch ( action ) {
218
220
case HoverVerbosityAction . Increase :
219
221
actionId = INCREASE_HOVER_VERBOSITY_ACTION_ID ;
220
222
accessibleActionId = INCREASE_HOVER_VERBOSITY_ACCESSIBLE_ACTION_ID ;
221
- actionLabel = INCREASE_HOVER_VERBOSITY_ACTION_LABEL ;
222
223
actionCodicon = Codicon . add ;
223
224
break ;
224
225
case HoverVerbosityAction . Decrease :
225
226
actionId = DECREASE_HOVER_VERBOSITY_ACTION_ID ;
226
227
accessibleActionId = DECREASE_HOVER_VERBOSITY_ACCESSIBLE_ACTION_ID ;
227
- actionLabel = DECREASE_HOVER_VERBOSITY_ACTION_LABEL ;
228
228
actionCodicon = Codicon . remove ;
229
229
break ;
230
230
}
231
+ const actionLabel = labelForHoverVerbosityAction ( this . _keybindingService , action ) ;
231
232
const actionEnabled = this . _hoverController . doesMarkdownHoverAtIndexSupportVerbosityAction ( this . _markdownHoverFocusedIndex , action ) ;
232
233
return new Action ( accessibleActionId , actionLabel , ThemeIcon . asClassName ( actionCodicon ) , actionEnabled , ( ) => {
233
234
editor . getAction ( actionId ) ?. run ( { index : this . _markdownHoverFocusedIndex , focus : false } ) ;
0 commit comments