fix(completion): prioritize exact snippet prefixes

This commit is contained in:
t8y2 committed 2026-07-31 15:46:15 +08:00
1 parent 65bf06f12e
commit 1d4ab520f3
2 files changed
+38 -1

No files matched your search

+3 -1
View File
@@ -1443,7 +1443,9 @@ class SqlCompletionProvider {
for (const item of this.items) {
// Alias snippets reuse the prefix as a label while applying alias SQL, so they are not exact name matches.
const isAliasSnippet = item.type === "snippet" && item.apply === formatAliasCompletionApply(item.label, this.databaseType);
if (!isAliasSnippet && item.label.toLowerCase() === context.prefix.toLowerCase()) {
const isExactLabelMatch = !isAliasSnippet && item.label.toLowerCase() === context.prefix.toLowerCase();
const isExactSnippetPrefixMatch = item.type === "snippet" && item.filterText?.toLowerCase() === context.prefix.toLowerCase();
if (isExactLabelMatch || isExactSnippetPrefixMatch) {
item.exactMatch = true;
item.boost += EXACT_LABEL_MATCH_BOOST;
}