fix(editor): restore keyword highlighting for standard-SQL dialects

Closes #8123
This commit is contained in:
t8y2 committed 2026-09-05 09:11:22 +08:00
1 parent 2a45374490
commit ffe1e58fbb
2 files changed
+25 -2

No files matched your search

@@ -233,8 +233,12 @@ export function createDbxCodeMirrorSqlDialect(langSql: CodeMirrorSqlLanguageModu
const isSqlServer = baseDialect === langSql.MSSQL;
const isPlsql = baseDialect === langSql.PLSQL;
const isClickHouse = databaseType === "clickhouse" || dialectName === "clickhouse";
const baseKeywords = isClickHouse ? standardSqlKeywordSyntaxTerms(langSql) : isPostgres ? postgresKeywordSyntaxTerms(baseDialect.spec.keywords || "") : baseDialect.spec.keywords || "";
const baseTypes = isClickHouse ? STANDARD_SQL_TYPES : baseDialect.spec.types || "";
// StandardSQL.spec exposes no vocabulary, so every StandardSQL-based dialect
// (generic JDBC, IRIS/Caché, H2, DB2, …) needs the reconstructed standard
// keyword set — without it SELECT/WHERE/AND highlight as plain identifiers.
const isStandardSql = isClickHouse || baseDialect === langSql.StandardSQL;
const baseKeywords = isStandardSql ? standardSqlKeywordSyntaxTerms(langSql) : isPostgres ? postgresKeywordSyntaxTerms(baseDialect.spec.keywords || "") : baseDialect.spec.keywords || "";
const baseTypes = isStandardSql ? STANDARD_SQL_TYPES : baseDialect.spec.types || "";
const commonKeywords = isClickHouse ? DBX_COMMON_SQL_KEYWORDS.toLowerCase() : DBX_COMMON_SQL_KEYWORDS;
const baseBuiltin = isSqlServer ? sqlServerBuiltinSyntaxTerms(baseDialect.spec.builtin || "") : baseDialect.spec.builtin || "";