fix(sql): keep required identifier quotes per dialect

This commit is contained in:
zipg authored and GitHub committed 2026-09-14 17:53:28 +08:00
1 parent 608633edff
commit 28e2568a8f
6 files changed
+132 -15

No files matched your search

@@ -3121,6 +3121,7 @@ async function resolveSqlHoverTooltip(currentView: EditorViewType, pos: number)
objectType: sqlObjectNavigationSourceKind(table),
};
let sqlContent: string | undefined;
const formatDialect = props.formatDialect ?? sqlFormatDialectForDbType(props.databaseType);
let metadataLoadFailed = false;
// The persisted display DDL is canonical across the full-page and hover
@@ -3135,7 +3136,6 @@ async function resolveSqlHoverTooltip(currentView: EditorViewType, pos: number)
// (the same one the sidebar/object-source viewers use). Tables keep
// the aligned column layout from reformatHoverDdl.
const isViewObject = objectMetadataRequest.objectType === "VIEW" || objectMetadataRequest.objectType === "MATERIALIZED_VIEW";
const formatDialect = props.formatDialect ?? sqlFormatDialectForDbType(props.databaseType);
const formatted = isViewObject ? await formatSqlForDisplay(rawDdl, formatDialect, settingsStore.editorSettings.sqlFormatter) : reformatHoverDdl(rawDdl, quoteQualifiedName(hoverQualifiedName));
sqlContent = settingsStore.editorSettings.generateSqlQuoteIdentifiers ? formatted : omitDdlIdentifierQuotes(formatted, formatDialect);
}
@@ -3170,6 +3170,7 @@ async function resolveSqlHoverTooltip(currentView: EditorViewType, pos: number)
}
if (fullColumns.length > 0) {
sqlContent = buildHoverTableSql(quoteQualifiedName(hoverQualifiedName), fullColumns, fullIndexes, tableComment);
if (!settingsStore.editorSettings.generateSqlQuoteIdentifiers) sqlContent = omitDdlIdentifierQuotes(sqlContent, formatDialect);
metadataLoadFailed = false;
}
}