fix(completion): restore result field suggestions

This commit is contained in:
t8y2 committed 2026-07-15 16:07:05 +08:00
1 parent 187a10f02d
commit b11f38d2df
2 files changed
+50 -2

No files matched your search

@@ -15,14 +15,16 @@ function fallbackColumnInfo(name: string): ColumnInfo {
export function tableMetaForDataTab(tab: QueryTab | undefined): DataTabTableMeta | undefined {
if (!tab || tab.mode !== "data") return undefined;
if (tab.tableMeta) return tab.tableMeta;
if (tab.tableMeta?.columns.length) return tab.tableMeta;
const tableName = tab.title.trim();
if (!tableName) return undefined;
// Keep filters usable when the table identity loaded but its column metadata did not.
return {
...tab.tableMeta,
schema: tab.schema,
tableName,
columns: (tab.result?.columns ?? []).map(fallbackColumnInfo),
primaryKeys: [],
primaryKeys: tab.tableMeta?.primaryKeys ?? [],
};
}