fix(redis): make completion menu follow typing

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.
This commit is contained in:
haipengno1 2026-06-16 22:46:24 +08:00 committed by GitHub
parent 6efdd335ed
commit f14973eaef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 1 deletions

View File

@ -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) {