@@ -24,12 +24,20 @@ function searchForIdentifier(
2424 let currentNode = node . prevSibling ;
2525 while ( currentNode ) {
2626 if ( [ 'CompositeIdentifier' , 'Identifier' ] . includes ( currentNode . type . name ) ) {
27- return getNodeString ( context , currentNode ) ;
27+ const maybeIdentifier = getNodeString ( context , currentNode ) ;
28+ if ( maybeIdentifier [ maybeIdentifier . length - 1 ] === '.' ) {
29+ // Maybe the identifier is not complete
30+ const nextNode = currentNode . nextSibling ;
31+ if ( nextNode && nextNode . type . name === 'Builtin' ) {
32+ return maybeIdentifier + getNodeString ( context , nextNode ) ;
33+ }
34+ }
35+ return maybeIdentifier ;
2836 } else if ( ! allowNodeWhenSearchForIdentify ( context , node ) ) {
2937 return null ;
3038 }
3139
32- currentNode = node . prevSibling ;
40+ currentNode = currentNode . prevSibling ;
3341 }
3442
3543 return null ;
@@ -46,6 +54,8 @@ function handleEnumAutoComplete(
4654 return null ;
4755 }
4856
57+ console . log ( currentNode ) ;
58+
4959 // This will handle
5060 // SELECT * FROM tblA WHERE tblA.colA IN (....)
5161 if ( currentNode ?. parent ?. type ?. name === 'Parens' ) {
@@ -56,6 +66,8 @@ function handleEnumAutoComplete(
5666
5767 // Let search for identifer
5868 const identifier = searchForIdentifier ( context , currentNode . prevSibling ) ;
69+ console . log ( identifier ) ;
70+
5971 if ( ! identifier ) return null ;
6072
6173 const [ table , column ] = identifier . replaceAll ( '`' , '' ) . split ( '.' ) ;
0 commit comments