From 7e95f774de19ded9e131e1ba18fdb8f1ae8ee662 Mon Sep 17 00:00:00 2001 From: Aiday Marlen Kyzy Date: Thu, 7 Nov 2024 10:45:51 +0100 Subject: [PATCH] disabling inline completions when in composition mode --- .../browser/controller/inlineCompletionsController.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.ts b/src/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.ts index d369260f852..69a9eb41644 100644 --- a/src/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.ts +++ b/src/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.ts @@ -70,11 +70,13 @@ export class InlineCompletionsController extends Disposable { private readonly _enabledInConfig = observableFromEvent(this, this.editor.onDidChangeConfiguration, () => this.editor.getOption(EditorOption.inlineSuggest).enabled); private readonly _isScreenReaderEnabled = observableFromEvent(this, this._accessibilityService.onDidChangeScreenReaderOptimized, () => this._accessibilityService.isScreenReaderOptimized()); + private _isInCompositionMode: boolean = false; + private readonly _editorDictationInProgress = observableFromEvent(this, this._contextKeyService.onDidChangeContext, () => this._contextKeyService.getContext(this.editor.getDomNode()).getValue('editorDictation.inProgress') === true ); - private readonly _enabled = derived(this, reader => this._enabledInConfig.read(reader) && (!this._isScreenReaderEnabled.read(reader) || !this._editorDictationInProgress.read(reader))); + private readonly _enabled = derived(this, reader => this._enabledInConfig.read(reader) && (!this._isScreenReaderEnabled.read(reader) || !this._editorDictationInProgress.read(reader)) && !this._isInCompositionMode); private readonly _debounceValue = this._debounceService.for( this._languageFeaturesService.inlineCompletionsProvider, @@ -292,6 +294,12 @@ export class InlineCompletionsController extends Disposable { })); this.editor.updateOptions({ inlineCompletionsAccessibilityVerbose: this._configurationService.getValue('accessibility.verbosity.inlineCompletions') }); + this._register(this.editor.onDidCompositionStart(() => { + this._isInCompositionMode = true; + })); + this._register(this.editor.onDidCompositionEnd(() => { + this._isInCompositionMode = false; + })); const contextKeySvcObs = new ObservableContextKeyService(this._contextKeyService); this._register(contextKeySvcObs.bind(InlineCompletionContextKeys.cursorInIndentation, this._cursorIsInIndentation));