File tree Expand file tree Collapse file tree 3 files changed +14
-14
lines changed
packages/server/src/complete Expand file tree Collapse file tree 3 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import { getNearestFromTableFromPos } from '../AstUtils'
4
4
import { Table } from '../../database_libs/AbstractClient'
5
5
import { toCompletionItemForKeyword } from '../CompletionItemUtils'
6
6
import { Pos } from '../complete'
7
- import { createTableCandidates } from './createTableCandidates'
7
+ import { createCatalogDatabaseAndTableCandidates } from './createTableCandidates'
8
8
9
9
export function createJoinCondidates (
10
10
ast : SelectStatement ,
@@ -18,7 +18,7 @@ export function createJoinCondidates(
18
18
const result : CompletionItem [ ] = [ ]
19
19
const fromTable = getNearestFromTableFromPos ( ast . from ?. tables || [ ] , pos )
20
20
if ( fromTable && fromTable . type === 'table' ) {
21
- result . push ( ...createTableCandidates ( tables , token , true ) )
21
+ result . push ( ...createCatalogDatabaseAndTableCandidates ( tables , token , true ) )
22
22
result . push ( toCompletionItemForKeyword ( 'INNER JOIN' ) )
23
23
result . push ( toCompletionItemForKeyword ( 'LEFT JOIN' ) )
24
24
result . push ( toCompletionItemForKeyword ( 'ON' ) )
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ function getFullyQualifiedTableName(table: Table): string {
19
19
return table . tableName
20
20
}
21
21
22
- export function createTableCandidates (
22
+ export function createCatalogDatabaseAndTableCandidates (
23
23
tables : Table [ ] ,
24
24
lastToken : string ,
25
25
onFromClause ?: boolean
@@ -55,13 +55,11 @@ export function createTableCandidates(
55
55
return [ ]
56
56
} )
57
57
58
- const uniqueEntities = [ ...new Set ( qualifiedEntities ) ]
59
-
60
- return uniqueEntities
61
- . map ( ( aTableNameVariant ) => {
58
+ return qualifiedEntities
59
+ . map ( ( databaseEntity ) => {
62
60
return new Identifier (
63
61
lastToken ,
64
- aTableNameVariant ,
62
+ databaseEntity ,
65
63
'' ,
66
64
ICONS . TABLE ,
67
65
onFromClause ? 'FROM' : 'OTHERS'
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ import {
23
23
getNearestFromTableFromPos ,
24
24
} from './AstUtils'
25
25
import { createBasicKeywordCandidates } from './candidates/createBasicKeywordCandidates'
26
- import { createTableCandidates } from './candidates/createTableCandidates'
26
+ import { createCatalogDatabaseAndTableCandidates } from './candidates/createTableCandidates'
27
27
import { createJoinCondidates } from './candidates/createJoinCandidates'
28
28
import {
29
29
createCandidatesForColumnsOfAnyTable ,
@@ -180,11 +180,13 @@ class Completer {
180
180
}
181
181
182
182
addCandidatesForTables ( tables : Table [ ] , onFromClause : boolean ) {
183
- createTableCandidates ( tables , this . lastToken , onFromClause ) . forEach (
184
- ( item ) => {
185
- this . addCandidate ( item )
186
- }
187
- )
183
+ createCatalogDatabaseAndTableCandidates (
184
+ tables ,
185
+ this . lastToken ,
186
+ onFromClause
187
+ ) . forEach ( ( item ) => {
188
+ this . addCandidate ( item )
189
+ } )
188
190
}
189
191
190
192
addCandidatesForColumnsOfAnyTable ( tables : Table [ ] ) {
You can’t perform that action at this time.
0 commit comments