Skip to content

Commit 1f450dd

Browse files
committed
using instead the type help and the resolved keybindings
1 parent 052aa39 commit 1f450dd

File tree

1 file changed

+7
-27
lines changed

1 file changed

+7
-27
lines changed

src/vs/editor/contrib/hover/browser/hoverAccessibleViews.ts

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55
import { localize } from 'vs/nls';
6-
import { format } from 'vs/base/common/strings';
76
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
87
import { HoverController } from 'vs/editor/contrib/hover/browser/hoverController';
98
import { AccessibleViewType, AccessibleViewProviderId, AdvancedContentProvider, IAccessibleViewContentProvider, IAccessibleViewOptions } from 'vs/platform/accessibility/browser/accessibleView';
109
import { IAccessibleViewImplentation } from 'vs/platform/accessibility/browser/accessibleViewRegistry';
1110
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
1211
import { IHoverService } from 'vs/platform/hover/browser/hover';
1312
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
14-
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
1513
import { HoverVerbosityAction } from 'vs/editor/common/languages';
1614
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';
1715
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
@@ -24,16 +22,14 @@ import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
2422

2523
namespace HoverAccessibilityHelpNLS {
2624
export const intro = localize('intro', "The hover widget is focused. Press the Tab key to cycle through the hover parts.");
27-
export const increaseVerbosity = localize('increaseVerbosity', "- The focused hover part verbosity level can be increased ({0}).");
28-
export const increaseVerbosityNoKb = localize('increaseVerbosityNoKb', "- The focused hover part verbosity level can be increased, which is currently not triggerable via keybinding.");
29-
export const decreaseVerbosity = localize('decreaseVerbosity', "- The focused hover part verbosity level can be decreased ({0}).");
30-
export const decreaseVerbosityNoKb = localize('decreaseVerbosityNoKb', "- The focused hover part verbosity level can be decreased, which is currently not triggerable via keybinding.");
25+
export const increaseVerbosity = localize('increaseVerbosity', "- The focused hover part verbosity level can be increased with the Increase Hover Verbosity command<keybinding:{0}>.", INCREASE_HOVER_VERBOSITY_ACTION_ID);
26+
export const decreaseVerbosity = localize('decreaseVerbosity', "- The focused hover part verbosity level can be decreased with the Decrease Hover Verbosity command<keybinding:{0}>.", DECREASE_HOVER_VERBOSITY_ACTION_ID);
3127
export const hoverContent = localize('contentHover', "The last focused hover content is the following.");
3228
}
3329

3430
export class HoverAccessibleView implements IAccessibleViewImplentation {
3531

36-
readonly type = AccessibleViewType.View;
32+
readonly type = AccessibleViewType.Help;
3733
readonly priority = 95;
3834
readonly name = 'hover';
3935
readonly when = EditorContextKeys.hoverFocused;
@@ -70,13 +66,12 @@ export class HoverAccessibilityHelpProvider extends Disposable implements IAcces
7066
public onDidChangeContent: Event<void> = this._onDidChangeContent.event;
7167

7268
constructor(
73-
private readonly _editor: ICodeEditor,
74-
@IKeybindingService private readonly _keybindingService: IKeybindingService
69+
private readonly _editor: ICodeEditor
7570
) {
7671
super();
7772
this.options = {
7873
language: this._editor.getModel()?.getLanguageId(),
79-
type: AccessibleViewType.View
74+
type: AccessibleViewType.Help
8075
};
8176
this._hoverController = HoverController.get(this._editor);
8277
this._initializeActions();
@@ -160,27 +155,12 @@ export class HoverAccessibilityHelpProvider extends Disposable implements IAcces
160155
if (!isActionSupported) {
161156
return;
162157
}
163-
let actionId: string;
164-
let descriptionWithKb: string;
165-
let descriptionWithoutKb: string;
166158
switch (action) {
167159
case HoverVerbosityAction.Increase:
168-
actionId = INCREASE_HOVER_VERBOSITY_ACTION_ID;
169-
descriptionWithKb = HoverAccessibilityHelpNLS.increaseVerbosity;
170-
descriptionWithoutKb = HoverAccessibilityHelpNLS.increaseVerbosityNoKb;
171-
break;
160+
return HoverAccessibilityHelpNLS.increaseVerbosity;
172161
case HoverVerbosityAction.Decrease:
173-
actionId = DECREASE_HOVER_VERBOSITY_ACTION_ID;
174-
descriptionWithKb = HoverAccessibilityHelpNLS.decreaseVerbosity;
175-
descriptionWithoutKb = HoverAccessibilityHelpNLS.decreaseVerbosityNoKb;
176-
break;
162+
return HoverAccessibilityHelpNLS.decreaseVerbosity;
177163
}
178-
return this._descriptionForCommand(actionId, descriptionWithKb, descriptionWithoutKb);
179-
}
180-
181-
private _descriptionForCommand(commandId: string, msg: string, noKbMsg: string): string {
182-
const kb = this._keybindingService.lookupKeybinding(commandId);
183-
return kb ? format(msg, kb.getAriaLabel()) : format(noKbMsg, commandId);
184164
}
185165

186166
private _descriptionOfFocusedMarkdownHover(hoverController: HoverController): string[] {

0 commit comments

Comments
 (0)