fix(completion): stop aliasing DELETE target tables

This commit is contained in:
onenewcode authored and GitHub committed 2026-09-16 11:28:31 +08:00
1 parent e916e9e927
commit 9bf52dab69
3 files changed
+156 -1

No files matched your search

+3 -1
View File
@@ -1433,6 +1433,8 @@ export interface SqlCompletionContext {
deleteTarget?: { table: string; schema?: string };
oracleTableFunctionContext?: boolean;
autoAliasTableCompletions: boolean;
/** The table position being completed is a DML target, where a generated alias can be rejected by the server. */
tableCompletionTargetAliasUnsafe?: boolean;
tableAliasAfterCursor?: boolean;
openingParenAfterCursor: boolean;
contextKind: SqlCompletionContextKind;
@@ -1665,7 +1667,7 @@ class SqlCompletionProvider {
}
if (!context.exclusiveColumnSuggestions && context.suggestTables) {
const autoAliasTables = !!this.input.autoAliasTables && context.autoAliasTableCompletions && supportsTableAliases(this.databaseType);
const autoAliasTables = !!this.input.autoAliasTables && context.autoAliasTableCompletions && !context.tableCompletionTargetAliasUnsafe && supportsTableAliases(this.databaseType);
this.items.push(...buildForeignKeyRelatedTableItems(context, completionTables, this.input.foreignKeysByTable, this.dialect, autoAliasTables, this.databaseType, this.input.keywordCase, this.input.currentSchema));
this.items.push(...buildTableItems(context, completionTables, this.dialect, autoAliasTables, context.referencedTables, this.databaseType, this.input.currentSchema, this.input.keywordCase));
if (this.databaseType === "clickhouse") {