@@ -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' ;
@@ -55,7 +56,11 @@ export class InlineCompletionsController extends Disposable {
55
56
} ) ;
56
57
}
57
58
) ) ;
58
- private readonly _enabled = observableFromEvent ( this . editor . onDidChangeConfiguration , ( ) => this . editor . getOption ( EditorOption . inlineSuggest ) . enabled ) ;
59
+ private readonly _enabledInConfig = observableFromEvent ( this . editor . onDidChangeConfiguration , ( ) => this . editor . getOption ( EditorOption . inlineSuggest ) . enabled ) ;
60
+ private readonly _isScreenReaderEnabled = observableFromEvent ( this . _accessibilityService . onDidChangeScreenReaderOptimized , ( ) => this . _accessibilityService . isScreenReaderOptimized ( ) ) ;
61
+ private readonly _editorDictationInProgress = observableFromEvent ( this . _contextKeyService . onDidChangeContext , ( ) => this . _contextKeyService . getContext ( this . editor . getDomNode ( ) ) . getValue ( 'editorDictation.inProgress' ) === true ) ;
62
+ private readonly _enabled = derived ( this , reader => this . _enabledInConfig . read ( reader ) && ( ! this . _isScreenReaderEnabled . read ( reader ) || ! this . _editorDictationInProgress . read ( reader ) ) ) ;
63
+
59
64
private readonly _fontFamily = observableFromEvent ( this . editor . onDidChangeConfiguration , ( ) => this . editor . getOption ( EditorOption . inlineSuggest ) . fontFamily ) ;
60
65
61
66
private readonly _ghostTexts = derived ( this , ( reader ) => {
@@ -95,6 +100,7 @@ export class InlineCompletionsController extends Disposable {
95
100
@ILanguageFeaturesService private readonly _languageFeaturesService : ILanguageFeaturesService ,
96
101
@IAccessibilitySignalService private readonly _accessibilitySignalService : IAccessibilitySignalService ,
97
102
@IKeybindingService private readonly _keybindingService : IKeybindingService ,
103
+ @IAccessibilityService private readonly _accessibilityService : IAccessibilityService ,
98
104
) {
99
105
super ( ) ;
100
106
@@ -148,6 +154,7 @@ export class InlineCompletionsController extends Disposable {
148
154
this . updateObservables ( tx , getReason ( e ) )
149
155
) ) ) ;
150
156
157
+
151
158
this . _register ( editor . onDidChangeCursorPosition ( e => transaction ( tx => {
152
159
/** @description InlineCompletionsController.onDidChangeCursorPosition */
153
160
this . updateObservables ( tx , VersionIdChangeReason . Other ) ;
0 commit comments