From f14973eaef79338e253ca86b8613b960979beb27 Mon Sep 17 00:00:00 2001 From: haipengno1 Date: Tue, 16 Jun 2026 22:46:24 +0800 Subject: [PATCH] fix(redis): make completion menu follow typing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The result used filter:false + validFor, which CodeMirror treats as mutually exclusive — validFor is ignored, so the list froze and the selection did not move while typing. Build the result with the default built-in filter so typing narrows the list and moves the selection. --- apps/desktop/src/components/editor/QueryEditor.vue | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/desktop/src/components/editor/QueryEditor.vue b/apps/desktop/src/components/editor/QueryEditor.vue index 5a255be2d..631d14542 100644 --- a/apps/desktop/src/components/editor/QueryEditor.vue +++ b/apps/desktop/src/components/editor/QueryEditor.vue @@ -990,7 +990,16 @@ async function provideRedisCompletions(currentState: import("@codemirror/state") if (epoch !== completionEpoch) return null; const items = buildRedisCompletionItemsFromContext(completionContext, { keys }); - return buildCompletionResult(items, completionContext.from, getRedisCompletionResultValidFor()); + if (items.length === 0) return null; + // Use the built-in filter (the default) so typing narrows the list and moves + // the selection synchronously. `filter: false` + `validFor` are mutually + // exclusive (the latter is ignored), which would leave the menu frozen while + // typing — hence we build the result here instead of via buildCompletionResult. + return { + from: completionContext.from, + options: items.map((item) => completionOptionForItem(item)), + validFor: getRedisCompletionResultValidFor(), + }; } async function provideSqlCompletions(currentState: import("@codemirror/state").EditorState, position: number, explicit: boolean) {