From 2a86fe684209a4715bc4ea736bd93d89fa026b48 Mon Sep 17 00:00:00 2001 From: LenAnderson Date: Sat, 20 Apr 2024 07:09:13 -0400 Subject: [PATCH] fix "no match" autocomplete message --- public/scripts/slash-commands.js | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/public/scripts/slash-commands.js b/public/scripts/slash-commands.js index d7b6543a3..865438a1c 100644 --- a/public/scripts/slash-commands.js +++ b/public/scripts/slash-commands.js @@ -2103,6 +2103,11 @@ export async function setSlashCommandAutoComplete(textarea, isFloating = false) return hide(); } // otherwise add "no match" notice + const option = new SlashCommandAutoCompleteOption( + OPTION_TYPE.BLANK, + null, + '', + ); switch (parserResult?.type) { case NAME_RESULT_TYPE.CLOSURE: { const li = document.createElement('li'); { @@ -2110,24 +2115,16 @@ export async function setSlashCommandAutoComplete(textarea, isFloating = false) `No matching variables in scope and no matching Quick Replies for "${slashCommand}"` : 'No variables in scope and no Quick Replies found.'; } - result.push({ - name: '', - value: null, - score: null, - li, - }); + option.dom = li; + result.push(option); break; } case NAME_RESULT_TYPE.COMMAND: { const li = document.createElement('li'); { li.textContent = `No matching commands for "/${slashCommand}"`; } - result.push({ - name: '', - value: null, - score: null, - li, - }); + option.dom = li; + result.push(option); break; } }