@@ -93,7 +93,7 @@ function queryEditor(QuerySnippet) {
9393 editor . focus ( ) ;
9494 } ,
9595 } ;
96-
96+ /*
9797 function removeExtraSchemaInfo(data) {
9898 let newColumns = [];
9999 data.forEach((table) => {
@@ -114,11 +114,11 @@ function queryEditor(QuerySnippet) {
114114 newColumns = []; // linter complains without this line
115115 return data;
116116 }
117-
117+ */
118118 const schemaCompleter = {
119119 getCompletions ( state , session , pos , prefix , callback ) {
120120 // make a variable for the auto completion in the query editor
121- $scope . autoCompleteSchema = removeExtraSchemaInfo ( $scope . schema ) ;
121+ $scope . autoCompleteSchema = $scope . schema ; // removeExtraSchemaInfo(
122122
123123 if ( prefix . length === 0 || ! $scope . autoCompleteSchema ) {
124124 callback ( null , [ ] ) ;
@@ -131,7 +131,16 @@ function queryEditor(QuerySnippet) {
131131 $scope . autoCompleteSchema . forEach ( ( table ) => {
132132 keywords [ table . name ] = 'Table' ;
133133
134- table . autoCompleteColumns . forEach ( ( c ) => {
134+ table . columns . forEach ( ( c ) => { // autoCompleteColumns
135+ if ( c . charAt ( c . length - 1 ) === ')' ) {
136+ let parensStartAt = c . indexOf ( '(' ) - 1 ;
137+ c = c . substring ( 0 , parensStartAt ) ;
138+ parensStartAt = 1 ; // linter complains without this line
139+ }
140+ // remove '[P] ' for partition keys
141+ if ( c . charAt ( 0 ) === '[' ) {
142+ c = c . substring ( 4 , c . length ) ;
143+ }
135144 keywords [ c ] = 'Column' ;
136145 keywords [ `${ table . name } .${ c } ` ] = 'Column' ;
137146 } ) ;
0 commit comments