@@ -32,6 +32,7 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
32
32
import { mapObservableArrayCached } from 'vs/base/common/observableInternal/utils' ;
33
33
import { ISettableObservable , observableValueOpts } from 'vs/base/common/observableInternal/base' ;
34
34
import { itemsEquals , itemEquals } from 'vs/base/common/equals' ;
35
+ import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility' ;
35
36
36
37
export class InlineCompletionsController extends Disposable {
37
38
static ID = 'editor.contrib.inlineCompletionsController' ;
@@ -56,6 +57,9 @@ export class InlineCompletionsController extends Disposable {
56
57
}
57
58
) ) ;
58
59
private readonly _enabled = observableFromEvent ( this . editor . onDidChangeConfiguration , ( ) => this . editor . getOption ( EditorOption . inlineSuggest ) . enabled ) ;
60
+ private readonly _enabledForScreenReader = observableFromEvent ( this . _accessibilityService . onDidChangeScreenReaderOptimized , ( ) => ! this . _accessibilityService . isScreenReaderOptimized ( ) || this . _contextKeyService . getContextKeyValue ( 'voiceChatInProgress' ) === false ) ;
61
+ private readonly _isEnabled = this . _enabled . get ( ) && this . _enabledForScreenReader . get ( ) ;
62
+
59
63
private readonly _fontFamily = observableFromEvent ( this . editor . onDidChangeConfiguration , ( ) => this . editor . getOption ( EditorOption . inlineSuggest ) . fontFamily ) ;
60
64
61
65
private readonly _ghostTexts = derived ( this , ( reader ) => {
@@ -95,6 +99,7 @@ export class InlineCompletionsController extends Disposable {
95
99
@ILanguageFeaturesService private readonly _languageFeaturesService : ILanguageFeaturesService ,
96
100
@IAccessibilitySignalService private readonly _accessibilitySignalService : IAccessibilitySignalService ,
97
101
@IKeybindingService private readonly _keybindingService : IKeybindingService ,
102
+ @IAccessibilityService private readonly _accessibilityService : IAccessibilityService ,
98
103
) {
99
104
super ( ) ;
100
105
@@ -120,6 +125,7 @@ export class InlineCompletionsController extends Disposable {
120
125
observableFromEvent ( editor . onDidChangeConfiguration , ( ) => editor . getOption ( EditorOption . suggest ) . previewMode ) ,
121
126
observableFromEvent ( editor . onDidChangeConfiguration , ( ) => editor . getOption ( EditorOption . inlineSuggest ) . mode ) ,
122
127
this . _enabled ,
128
+ this . _enabledForScreenReader
123
129
) ;
124
130
this . model . set ( model , tx ) ;
125
131
}
@@ -159,7 +165,7 @@ export class InlineCompletionsController extends Disposable {
159
165
this . _register ( editor . onDidType ( ( ) => transaction ( tx => {
160
166
/** @description InlineCompletionsController.onDidType */
161
167
this . updateObservables ( tx , VersionIdChangeReason . Other ) ;
162
- if ( this . _enabled . get ( ) ) {
168
+ if ( this . _isEnabled ) {
163
169
this . model . get ( ) ?. trigger ( tx ) ;
164
170
}
165
171
} ) ) ) ;
@@ -173,7 +179,7 @@ export class InlineCompletionsController extends Disposable {
173
179
inlineSuggestCommitId ,
174
180
'acceptSelectedSuggestion' ,
175
181
] ) ;
176
- if ( commands . has ( e . commandId ) && editor . hasTextFocus ( ) && this . _enabled . get ( ) ) {
182
+ if ( commands . has ( e . commandId ) && editor . hasTextFocus ( ) && this . _isEnabled ) {
177
183
transaction ( tx => {
178
184
/** @description onDidExecuteCommand */
179
185
this . model . get ( ) ?. trigger ( tx ) ;
0 commit comments