Skip to content
Prev Previous commit
Next Next commit
Don't suggest automatic table aliasing insert text
  • Loading branch information
the21st committed Mar 16, 2023
commit 81f762e6db22bf6d8df431e79d15f6904cf3103d
8 changes: 1 addition & 7 deletions packages/server/src/complete/Identifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,12 @@ export class Identifier {
const idx = this.lastToken.lastIndexOf('.')
const label = this.identifier.substring(idx + 1)
let kindName: string
let tableAlias = ''
if (this.kind === ICONS.TABLE) {
let tableName = label
const i = tableName.lastIndexOf('.')
if (i > 0) {
tableName = label.substring(i + 1)
}
tableAlias = this.onClause === 'FROM' ? makeTableAlias(tableName) : ''
kindName = 'table'
} else {
kindName = 'column'
Expand All @@ -66,11 +64,7 @@ export class Identifier {
}

if (this.kind === ICONS.TABLE) {
if (tableAlias) {
item.insertText = `${label} AS ${tableAlias}`
} else {
item.insertText = label
}
item.insertText = label
}
return item
}
Expand Down