[autocomplete] optimistic client-side filtering

This commit is contained in:
Shish 2023-12-29 12:04:05 +00:00
parent 0e887175e0
commit d82df9d7d8

View file

@ -93,7 +93,10 @@ function renderCompletions(element) {
completions_el.id = 'completions';
// add children for top completions, with the selected one highlighted
Object.keys(completions).slice(0, 100).forEach((key, i) => {
let word = getCurrentWord(element);
Object.keys(completions).filter(
(key) => key.toLowerCase().startsWith(word.toLowerCase())
).slice(0, 100).forEach((key, i) => {
let value = completions[key];
let li = document.createElement('li');
li.innerText = key + ' (' + value + ')';