Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't detach completion popup while typing when prefix is empty #5517

Merged
merged 11 commits into from
Mar 22, 2024
2 changes: 0 additions & 2 deletions src/autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,6 @@ class Autocomplete {
if (this.tooltipNode) {
this.updateDocTooltip();
}
} else if (keepPopupPosition && !prefix) {
this.detach();
akoreman marked this conversation as resolved.
Show resolved Hide resolved
}
this.changeTimer.cancel();
this.observeLayoutChanges();
Expand Down
14 changes: 11 additions & 3 deletions src/autocomplete_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"use strict";

var sendKey = require("./test/user").type;
var {buildDom} = require("./lib/dom");

Check warning on line 8 in src/autocomplete_test.js

View workflow job for this annotation

GitHub Actions / build (16.x)

'buildDom' is assigned a value but never used
var ace = require("./ace");
var assert = require("./test/assertions");
var user = require("./test/user");
Expand Down Expand Up @@ -487,6 +487,7 @@
}
];

user.type(" ");
user.type("t");
user.type("e");
assert.ok(!editor.completer || !editor.completer.popup.isOpen);
Expand All @@ -495,9 +496,16 @@
assert.ok(editor.completers[1].timeout);
user.type("Home");
setTimeout(function() {
assert.ok(!editor.completer.popup.isOpen);
assert.ok(!editor.completers[1].timeout);
done();
assert.ok(editor.completer.popup.isOpen);
assert.ok(editor.completers[1].timeout);

user.type("Left");

setTimeout(function() {
assert.ok(!editor.completer.popup.isOpen);
assert.ok(!editor.completers[1].timeout);
done();
}, 0);
}, 0);
}, 11);
},
Expand Down
Loading