@@ -16,6 +16,7 @@ import { AccessibilityHelpNLS } from 'vs/editor/common/standaloneStrings';
16
16
import { LinkDetector } from 'vs/editor/contrib/links/browser/links' ;
17
17
import { localize } from 'vs/nls' ;
18
18
import { IConfigurationService } from 'vs/platform/configuration/common/configuration' ;
19
+ import { IContextKey , IContextKeyService , RawContextKey } from 'vs/platform/contextkey/common/contextkey' ;
19
20
import { IContextViewDelegate , IContextViewService } from 'vs/platform/contextview/browser/contextView' ;
20
21
import { IInstantiationService , createDecorator } from 'vs/platform/instantiation/common/instantiation' ;
21
22
import { IOpenerService } from 'vs/platform/opener/common/opener' ;
@@ -56,20 +57,23 @@ export interface IAccessibleViewOptions {
56
57
type : AccessibleViewType ;
57
58
}
58
59
60
+ export const accessibilityHelpIsShown = new RawContextKey < boolean > ( 'accessibilityHelpIsShown' , false , true ) ;
59
61
class AccessibleView extends Disposable {
60
62
private _editorWidget : CodeEditorWidget ;
63
+ private _accessiblityHelpIsShown : IContextKey < boolean > ;
61
64
get editorWidget ( ) { return this . _editorWidget ; }
62
65
private _editorContainer : HTMLElement ;
63
66
private _keyListener : IDisposable | undefined ;
64
-
65
67
constructor (
66
68
@IOpenerService private readonly _openerService : IOpenerService ,
67
69
@IInstantiationService private readonly _instantiationService : IInstantiationService ,
68
70
@IConfigurationService private readonly _configurationService : IConfigurationService ,
69
71
@IModelService private readonly _modelService : IModelService ,
70
- @IContextViewService private readonly _contextViewService : IContextViewService
72
+ @IContextViewService private readonly _contextViewService : IContextViewService ,
73
+ @IContextKeyService private readonly _contextKeyService : IContextKeyService
71
74
) {
72
75
super ( ) ;
76
+ this . _accessiblityHelpIsShown = accessibilityHelpIsShown . bindTo ( this . _contextKeyService ) ;
73
77
this . _editorContainer = document . createElement ( 'div' ) ;
74
78
this . _editorContainer . classList . add ( 'accessible-view' ) ;
75
79
const codeEditorWidgetOptions : ICodeEditorWidgetOptions = {
@@ -96,9 +100,17 @@ class AccessibleView extends Disposable {
96
100
getAnchor : ( ) => this . _editorContainer ,
97
101
render : ( container ) => {
98
102
return this . _render ( provider , container ) ;
103
+ } ,
104
+ onHide : ( ) => {
105
+ if ( provider . options . type === AccessibleViewType . HelpMenu ) {
106
+ this . _accessiblityHelpIsShown . reset ( ) ;
107
+ }
99
108
}
100
109
} ;
101
110
this . _contextViewService . showContextView ( delegate ) ;
111
+ if ( provider . options . type === AccessibleViewType . HelpMenu ) {
112
+ this . _accessiblityHelpIsShown . set ( true ) ;
113
+ }
102
114
}
103
115
104
116
private _render ( provider : IAccessibleContentProvider , container : HTMLElement ) : IDisposable {
0 commit comments