feat(editor): configure SQL completion column ordering

Closes #5955
This commit is contained in:
t8y2 committed 2026-08-13 06:54:51 +00:00
1 parent 31a7609604
commit 18d581137c
10 files changed
+157 -3

No files matched your search

@@ -4,6 +4,12 @@ export interface CompletionLabelPresentation {
sortText?: string;
}
export interface CompletionSortItem {
label: string;
sortText?: string;
type?: string;
}
export function completionLabelPresentation(label: string, filterText?: string): CompletionLabelPresentation {
const normalizedFilterText = filterText?.trim();
if (!normalizedFilterText || label.toLowerCase().startsWith(normalizedFilterText.toLowerCase())) return { label };
@@ -13,3 +19,8 @@ export function completionLabelPresentation(label: string, filterText?: string):
sortText: label,
};
}
export function compareSqlCompletions(a: CompletionSortItem, b: CompletionSortItem, sortColumnsAlphabetically: boolean): number {
if (!sortColumnsAlphabetically && a.type === "column" && b.type === "column") return 0;
return (a.sortText || a.label).localeCompare(b.sortText || b.label);
}