feat(dolt): add native profile, branch database discovery, and SQL completion

This commit is contained in:
hanxuanyu authored and GitHub committed 2026-08-10 00:37:34 +08:00
1 parent 56edbd3656
commit 681c6f35c5
19 files changed
+304 -23

No files matched your search

@@ -1143,6 +1143,7 @@ const driverProfiles: Record<
icon: "mysql",
urlParams: "",
},
dolt: { type: "mysql", port: 3306, user: "root", label: "Dolt", icon: "dolt", urlParams: "" },
custom_postgres: {
type: "postgres",
port: 5432,
@@ -2662,6 +2663,7 @@ const iconTypeMap: Record<string, string> = {
victoriametrics: "victoriametrics",
jdbc: "jdbc",
custom_mysql: "mysql",
dolt: "dolt",
custom_postgres: "postgres",
...jdbcProductIconTypes(),
};
@@ -2749,6 +2751,7 @@ const dbOptions: DbOption[] = [
{ value: "jdbcx", label: "JDBCX" },
{ value: "manticoresearch", label: "Manticore Search" },
{ value: "custom_mysql", label: "Custom (MySQL)" },
{ value: "dolt", label: "Dolt" },
{ value: "custom_postgres", label: "Custom (PostgreSQL)" },
{ value: "dremio", label: "Dremio" },
...jdbcProductPickerOptions(),
@@ -2762,7 +2765,7 @@ const dbCategoryDefinitions: Array<{
{
key: "sql",
titleKey: "connection.databaseCategorySql",
optionValues: ["postgres", "mysql", "oracle", "sqlserver", "mariadb", "cockroachdb", "db2", "informix", "firebird", "iris", "jdbcx", "custom_mysql", "custom_postgres"],
optionValues: ["postgres", "mysql", "oracle", "sqlserver", "mariadb", "cockroachdb", "db2", "informix", "firebird", "iris", "jdbcx", "custom_mysql", "custom_postgres", "dolt"],
},
{
key: "analytics",
@@ -223,6 +223,7 @@ const snippetDatabaseType = computed(() => {
const connection = props.connectionId ? connectionStore.getConfig(props.connectionId) : undefined;
return sqlSnippetDatabaseTypeForConnection(connection) ?? props.databaseType;
});
const sqlDriverProfile = computed(() => (props.connectionId ? connectionStore.getConfig(props.connectionId)?.driver_profile : undefined));
const SQL_FUNCTION_NAMES = [
"COUNT",
@@ -3192,6 +3193,7 @@ async function provideSqlCompletions(context: CompletionContext) {
snippets: settingsStore.editorSettings.snippets,
dialect: props.dialect,
databaseType: snippetDatabaseType.value,
driverProfile: sqlDriverProfile.value,
currentSchema: props.schema,
keywordCase: settingsStore.editorSettings.sqlFormatter.keywordCase,
functionCase: settingsStore.editorSettings.sqlFormatter.functionCase,
@@ -3252,6 +3254,7 @@ async function provideSqlCompletions(context: CompletionContext) {
snippets: settingsStore.editorSettings.snippets,
dialect: props.dialect,
databaseType: snippetDatabaseType.value,
driverProfile: sqlDriverProfile.value,
currentSchema: props.schema,
keywordCase: settingsStore.editorSettings.sqlFormatter.keywordCase,
functionCase: settingsStore.editorSettings.sqlFormatter.functionCase,
@@ -3519,6 +3522,7 @@ function buildLocalSqlCompletionResult(completionContext: ReturnType<typeof getS
snippets: settingsStore.editorSettings.snippets,
dialect: props.dialect,
databaseType: snippetDatabaseType.value,
driverProfile: sqlDriverProfile.value,
currentSchema: scope.schema,
keywordCase: settingsStore.editorSettings.sqlFormatter.keywordCase,
functionCase: settingsStore.editorSettings.sqlFormatter.functionCase,
@@ -3979,6 +3983,7 @@ async function performAsyncCompletionWithResult(epoch: number, completionContext
snippets: settingsStore.editorSettings.snippets,
dialect: props.dialect,
databaseType: snippetDatabaseType.value,
driverProfile: sqlDriverProfile.value,
currentSchema: scope.schema,
keywordCase: settingsStore.editorSettings.sqlFormatter.keywordCase,
functionCase: settingsStore.editorSettings.sqlFormatter.functionCase,
@@ -4358,7 +4363,7 @@ onMounted(async () => {
};
buildSqlSignatureExtension = () =>
showTooltip.compute(["doc", "selection"], (currentState) => {
const signature = getSqlFunctionSignatureHelp(currentState.doc.toString(), currentState.selection.main.head, props.databaseType);
const signature = getSqlFunctionSignatureHelp(currentState.doc.toString(), currentState.selection.main.head, props.databaseType, sqlDriverProfile.value);
if (!signature) return null;
return {
pos: currentState.selection.main.head,
@@ -4376,7 +4381,7 @@ onMounted(async () => {
buildSqlLanguageExtension = () =>
langSql.sql({
dialect: createDbxCodeMirrorSqlDialect(langSql, props.syntaxDialect ?? props.dialect, props.databaseType),
dialect: createDbxCodeMirrorSqlDialect(langSql, props.syntaxDialect ?? props.dialect, props.databaseType, sqlDriverProfile.value),
});
buildSqlSemanticHighlightExtension = () => [
ViewPlugin.fromClass(
@@ -5112,7 +5117,7 @@ watch([() => props.clientSessionId, () => props.completionContextVersion], () =>
scheduleSemanticDiagnostics();
});
watch([() => props.databaseType, () => props.dialect, () => props.syntaxDialect], () => {
watch([() => props.databaseType, () => props.dialect, () => props.syntaxDialect, sqlDriverProfile], () => {
executableStatementRangeCache = null;
if (!view.value || !sqlLanguageComp || !buildSqlLanguageExtension || !sqlSemanticHighlightComp || !buildSqlSemanticHighlightExtension || !sqlSignatureComp || !buildSqlSignatureExtension) return;
// Signature tooltips depend on the external dialect, so refresh them even when the document and selection stay unchanged.
@@ -106,6 +106,7 @@ const assetIcons: Record<string, string> = {
oscar: "oscar.png",
jdbcx: "jdbcx",
mqtt: "mqtt",
dolt: "dolt",
};
const normalizedType = computed(() => props.dbType.toLowerCase().replace(/[\s-]+/g, "_"));