Skip to content

Commit 7329258

Browse files
Don't run onDidBlurEditorWidget and onDidFocusEditorText if inline edit is disabled (microsoft#205378)
1 parent b128796 commit 7329258

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/vs/editor/contrib/inlineEdit/browser/inlineEditController.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,13 @@ export class InlineEditController extends Disposable {
110110
}));
111111

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

123129
//Invoke provider on focus
124-
this._register(editor.onDidFocusEditorText(async () => {
125-
if (!this._enabled.get()) {
130+
const editorFocusSignal = observableSignalFromEvent('InlineEditController.editorFocusSignal', editor.onDidFocusEditorText);
131+
this._register(autorun(reader => {
132+
/** @description InlineEditController.editorFocus */
133+
if (!this._enabled.read(reader)) {
126134
return;
127135
}
128-
await this.getInlineEdit(editor, true);
136+
editorFocusSignal.read(reader);
137+
this.getInlineEdit(editor, true);
129138
}));
130139

131140

0 commit comments

Comments
 (0)