Skip to content

Commit

Permalink
Don't run onDidBlurEditorWidget and onDidFocusEditorText if inlin…
Browse files Browse the repository at this point in the history
…e edit is disabled (#205378)
  • Loading branch information
Krzysztof-Cieslak committed Feb 19, 2024
1 parent b128796 commit 7329258
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/vs/editor/contrib/inlineEdit/browser/inlineEditController.ts
Expand Up @@ -110,7 +110,13 @@ export class InlineEditController extends Disposable {
}));

//Clear suggestions on lost focus
this._register(editor.onDidBlurEditorWidget(() => {
const editorBlurSingal = observableSignalFromEvent('InlineEditController.editorBlurSignal', editor.onDidBlurEditorWidget);
this._register(autorun(reader => {
/** @description InlineEditController.editorBlur */
if (!this._enabled.read(reader)) {
return;
}
editorBlurSingal.read(reader);
// This is a hidden setting very useful for debugging
if (this._configurationService.getValue('editor.experimentalInlineEdit.keepOnBlur') || editor.getOption(EditorOption.inlineEdit).keepOnBlur) {
return;
Expand All @@ -121,11 +127,14 @@ export class InlineEditController extends Disposable {
}));

//Invoke provider on focus
this._register(editor.onDidFocusEditorText(async () => {
if (!this._enabled.get()) {
const editorFocusSignal = observableSignalFromEvent('InlineEditController.editorFocusSignal', editor.onDidFocusEditorText);
this._register(autorun(reader => {
/** @description InlineEditController.editorFocus */
if (!this._enabled.read(reader)) {
return;
}
await this.getInlineEdit(editor, true);
editorFocusSignal.read(reader);
this.getInlineEdit(editor, true);
}));


Expand Down

0 comments on commit 7329258

Please sign in to comment.