提交 60754980 编写于 作者: J Johannes Rieken

only add light bulb when editor has text focus, #11022

上级 cd2cccfb
......@@ -158,8 +158,9 @@ export class QuickFixModel extends EventEmitter {
if (!this.updateScheduler) {
this.updateScheduler = new RunOnceScheduler(() => {
var marker = this.lastMarker;
var pos = this.editor.getPosition();
const pos = this.editor.getPosition();
let marker = this.lastMarker;
if (marker && Range.containsPosition(marker, pos)) {
// still on the same marker
if (this.lightBulpPosition) {
......@@ -168,6 +169,12 @@ export class QuickFixModel extends EventEmitter {
return;
}
if (!this.editor.isFocused()) {
// remove lightbulb when editor lost focus
this.setDecoration(null);
return;
}
this.lastMarker = marker = this.findMarker(pos, false);
if (!marker) {
// remove lightbulp
......@@ -175,8 +182,8 @@ export class QuickFixModel extends EventEmitter {
return;
}
var $tRequest = timer.start(timer.Topic.EDITOR, 'quickfix/lighbulp');
var computeFixesPromise = this.computeFixes(marker);
const $tRequest = timer.start(timer.Topic.EDITOR, 'quickfix/lighbulp');
const computeFixesPromise = this.computeFixes(marker);
computeFixesPromise.done((fixes) => {
this.setDecoration(!arrays.isFalsyOrEmpty(fixes) ? pos : null);
this.triggerAutoSuggest(marker);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册