@@ -52,7 +52,7 @@ export default class IntellisensePlugin<T extends ILanguageServer> implements IL
5252 }
5353 }
5454
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 [ ] > => {
5656 const prefix = ( suggestDatabases . prependQuestionMark ? "? " : "" ) + ( suggestDatabases . prependFrom ? "FROM " : "" ) ;
5757 const suffix = suggestDatabases . appendDot ? "." : "" ;
5858
@@ -70,7 +70,7 @@ export default class IntellisensePlugin<T extends ILanguageServer> implements IL
7070 return [ ] ;
7171 }
7272
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 [ ] > => {
7474 const prefix = ( suggestTables . prependQuestionMark ? "? " : "" ) + ( suggestTables . prependFrom ? "FROM " : "" ) ;
7575 const database = suggestTables . identifierChain && suggestTables . identifierChain [ 0 ] . name ;
7676 const suffix = suggestTables . appendDot ? "." : "" ;
@@ -89,7 +89,7 @@ export default class IntellisensePlugin<T extends ILanguageServer> implements IL
8989 return [ ] ;
9090 }
9191
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 [ ] > => {
9393 const tables = suggestColumns . tables
9494 . map ( table => table . identifierChain . map ( id => id . name || id . cte ) )
9595 . map ( ( t : [ string ] ) => ( < NSDatabase . ITable > { label : t . pop ( ) , database : t . pop ( ) } ) ) ;
@@ -107,7 +107,7 @@ export default class IntellisensePlugin<T extends ILanguageServer> implements IL
107107 return [ ] ;
108108 }
109109
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 [ ] > => {
111111 let completionsMap = {
112112 query : [ ] ,
113113 tables : [ ] ,
@@ -166,7 +166,7 @@ export default class IntellisensePlugin<T extends ILanguageServer> implements IL
166166 . concat ( completionsMap . tables )
167167 . concat ( completionsMap . dbs )
168168 . concat ( completionsMap . query ) ;
169-
169+
170170 return completions ;
171171 }
172172
@@ -182,13 +182,12 @@ export default class IntellisensePlugin<T extends ILanguageServer> implements IL
182182 // First try to get completions from connection's getCompletionsForRawQuery method
183183 const connectionCompletions = await conn . getCompletionsForRawQuery ( text , currentOffset ) ;
184184 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 ) ;
186186 return connectionCompletions ;
187187 }
188-
189188
190189 // 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 ' ) ;
192191 const completions = await this . getCompletionsFromHueAst ( { currentWord, conn, text, currentOffset } ) ;
193192 log . debug ( 'total completions %d' , completions . length ) ;
194193 return completions ;
0 commit comments