@@ -52,7 +52,7 @@ export default class IntellisensePlugin<T extends ILanguageServer> implements IL
52
52
}
53
53
}
54
54
55
- private getDatabasesCompletions = async ( { currentWord, conn, suggestDatabases } : { conn : Connection ; currentWord : string ; suggestDatabases : any } ) => {
55
+ private getDatabasesCompletions = async ( { currentWord, conn, suggestDatabases } : { conn : Connection ; currentWord : string ; suggestDatabases : any } ) : Promise < CompletionItem [ ] > => {
56
56
const prefix = ( suggestDatabases . prependQuestionMark ? "? " : "" ) + ( suggestDatabases . prependFrom ? "FROM " : "" ) ;
57
57
const suffix = suggestDatabases . appendDot ? "." : "" ;
58
58
@@ -70,7 +70,7 @@ export default class IntellisensePlugin<T extends ILanguageServer> implements IL
70
70
return [ ] ;
71
71
}
72
72
73
- private getTableCompletions = async ( { currentWord, conn, suggestTables } : { conn : Connection ; currentWord : string ; suggestTables : any } ) => {
73
+ private getTableCompletions = async ( { currentWord, conn, suggestTables } : { conn : Connection ; currentWord : string ; suggestTables : any } ) : Promise < CompletionItem [ ] > => {
74
74
const prefix = ( suggestTables . prependQuestionMark ? "? " : "" ) + ( suggestTables . prependFrom ? "FROM " : "" ) ;
75
75
const database = suggestTables . identifierChain && suggestTables . identifierChain [ 0 ] . name ;
76
76
const suffix = suggestTables . appendDot ? "." : "" ;
@@ -89,7 +89,7 @@ export default class IntellisensePlugin<T extends ILanguageServer> implements IL
89
89
return [ ] ;
90
90
}
91
91
92
- private getColumnCompletions = async ( { currentWord, conn, suggestColumns } : { conn : Connection ; currentWord : string ; suggestColumns : any } ) => {
92
+ private getColumnCompletions = async ( { currentWord, conn, suggestColumns } : { conn : Connection ; currentWord : string ; suggestColumns : any } ) : Promise < CompletionItem [ ] > => {
93
93
const tables = suggestColumns . tables
94
94
. map ( table => table . identifierChain . map ( id => id . name || id . cte ) )
95
95
. map ( ( t : [ string ] ) => ( < NSDatabase . ITable > { label : t . pop ( ) , database : t . pop ( ) } ) ) ;
@@ -107,7 +107,7 @@ export default class IntellisensePlugin<T extends ILanguageServer> implements IL
107
107
return [ ] ;
108
108
}
109
109
110
- private getCompletionsFromHueAst = async ( { currentWord, conn, text, currentOffset } : { currentWord : string ; conn : Connection | null ; text : string ; currentOffset : number } ) => {
110
+ private getCompletionsFromHueAst = async ( { currentWord, conn, text, currentOffset } : { currentWord : string ; conn : Connection | null ; text : string ; currentOffset : number } ) : Promise < CompletionItem [ ] > => {
111
111
let completionsMap = {
112
112
query : [ ] ,
113
113
tables : [ ] ,
@@ -166,7 +166,7 @@ export default class IntellisensePlugin<T extends ILanguageServer> implements IL
166
166
. concat ( completionsMap . tables )
167
167
. concat ( completionsMap . dbs )
168
168
. concat ( completionsMap . query ) ;
169
-
169
+
170
170
return completions ;
171
171
}
172
172
@@ -182,13 +182,12 @@ export default class IntellisensePlugin<T extends ILanguageServer> implements IL
182
182
// First try to get completions from connection's getCompletionsForRawQuery method
183
183
const connectionCompletions = await conn . getCompletionsForRawQuery ( text , currentOffset ) ;
184
184
if ( connectionCompletions !== null ) {
185
- log . debug ( 'using connection completions, count: %d' , connectionCompletions . length ) ;
185
+ log . debug ( 'Got completions from raw the query , count: %d' , connectionCompletions . length ) ;
186
186
return connectionCompletions ;
187
187
}
188
-
189
188
190
189
// Fallback to hue AST-based completions
191
- log . debug ( 'falling back to hue AST completions ' ) ;
190
+ log . debug ( 'Using completions based on hue SQL parser ' ) ;
192
191
const completions = await this . getCompletionsFromHueAst ( { currentWord, conn, text, currentOffset } ) ;
193
192
log . debug ( 'total completions %d' , completions . length ) ;
194
193
return completions ;
0 commit comments