@@ -13,7 +13,7 @@ import { localize } from 'vs/nls';
13
13
import { AccessibilitySupport } from 'vs/platform/accessibility/common/accessibility' ;
14
14
import { InstantiationType , registerSingleton } from 'vs/platform/instantiation/common/extensions' ;
15
15
import { IKeybindingService , IKeyboardEvent } from 'vs/platform/keybinding/common/keybinding' ;
16
- import { AccessibilityHelpAction , registerAccessibilityConfiguration } from 'vs/workbench/contrib/accessibility/browser/accessibilityContribution' ;
16
+ import { AccessibilityHelpAction , AccessibilityViewAction , registerAccessibilityConfiguration } from 'vs/workbench/contrib/accessibility/browser/accessibilityContribution' ;
17
17
import { AccessibleViewService , IAccessibleContentProvider , IAccessibleViewOptions , IAccessibleViewService } from 'vs/workbench/contrib/accessibility/browser/accessibleView' ;
18
18
import * as strings from 'vs/base/common/strings' ;
19
19
import * as platform from 'vs/base/common/platform' ;
@@ -26,6 +26,8 @@ import { NEW_UNTITLED_FILE_COMMAND_ID } from 'vs/workbench/contrib/files/browser
26
26
import { KeyCode } from 'vs/base/common/keyCodes' ;
27
27
import { URI } from 'vs/base/common/uri' ;
28
28
import { IOpenerService } from 'vs/platform/opener/common/opener' ;
29
+ import { ModesHoverController } from 'vs/editor/contrib/hover/browser/hover' ;
30
+ import { withNullAsUndefined } from 'vs/base/common/types' ;
29
31
30
32
registerAccessibilityConfiguration ( ) ;
31
33
registerSingleton ( IAccessibleViewService , AccessibleViewService , InstantiationType . Delayed ) ;
@@ -134,3 +136,44 @@ const workbenchRegistry = Registry.as<IWorkbenchContributionsRegistry>(Workbench
134
136
workbenchRegistry . registerWorkbenchContribution ( EditorAccessibilityHelpContribution , LifecyclePhase . Eventually ) ;
135
137
136
138
139
+
140
+ class HoverAccessibileViewContribution extends Disposable {
141
+ static ID : 'hoverAccessibleViewContribution' ;
142
+ constructor ( ) {
143
+ super ( ) ;
144
+ this . _register ( AccessibilityViewAction . addImplementation ( 105 , 'hover' , accessor => {
145
+ const accessibleViewService = accessor . get ( IAccessibleViewService ) ;
146
+ const codeEditorService = accessor . get ( ICodeEditorService ) ;
147
+ const editor = codeEditorService . getActiveCodeEditor ( ) || codeEditorService . getFocusedCodeEditor ( ) ;
148
+ if ( ! editor ) {
149
+ return false ;
150
+ }
151
+ const controller = ModesHoverController . get ( editor ) ;
152
+ const hoverContent = withNullAsUndefined ( controller ?. getWidgetContents ( ) ) ;
153
+ if ( ! controller || ! hoverContent ) {
154
+ return false ;
155
+ }
156
+ function provideContent ( ) : string {
157
+ return hoverContent ! ;
158
+ }
159
+ const provider = accessibleViewService . registerProvider ( {
160
+ id : 'hover' ,
161
+ provideContent,
162
+ onClose ( ) {
163
+ provider . dispose ( ) ;
164
+ controller . focus ( ) ;
165
+ } ,
166
+ onKeyDown ( e : IKeyboardEvent ) {
167
+
168
+ } ,
169
+ options : { ariaLabel : localize ( 'hoverAccessibleView' , "Hover Accessible View" ) }
170
+ } ) ;
171
+ accessibleViewService . show ( 'hover' ) ;
172
+ return true ;
173
+ } ) ) ;
174
+ }
175
+ }
176
+
177
+ const workbenchContributionsRegistry = Registry . as < IWorkbenchContributionsRegistry > ( WorkbenchExtensions . Workbench ) ;
178
+ workbenchContributionsRegistry . registerWorkbenchContribution ( HoverAccessibileViewContribution , LifecyclePhase . Eventually ) ;
179
+
0 commit comments