@@ -84,12 +84,23 @@ export const createSchemaCompletionProvider = (
8484 const openQuote = textUntilPosition . substr ( - 1 ) === '"'
8585 const nextCharQuote = nextChar === '"'
8686
87+ // get text value in the current line
88+ const textInLine = model . getValueInRange ( {
89+ startLineNumber : position . lineNumber ,
90+ startColumn : 1 ,
91+ endLineNumber : position . lineNumber ,
92+ endColumn : position . column ,
93+ } )
94+ // check if `textInLine` contains whitespaces only
95+ const isWhitespaceOnly = / ^ \s * $ / . test ( textInLine )
96+
8797 if (
88- / ( F R O M | I N T O | ( A L T E R | B A C K U P | D R O P | R E I N D E X | R E N A M E | T R U N C A T E | V A C U U M ) T A B L E | J O I N | U P D A T E ) \s $ / gim. test (
89- textUntilPosition ,
90- ) ||
91- ( / ' $ / gim. test ( textUntilPosition ) &&
92- ! textUntilPosition . endsWith ( "= '" ) )
98+ ( / ( F R O M | I N T O | ( A L T E R | B A C K U P | D R O P | R E I N D E X | R E N A M E | T R U N C A T E | V A C U U M ) T A B L E | J O I N | U P D A T E ) \s $ / gim. test (
99+ textUntilPosition ,
100+ ) ||
101+ ( / ' $ / gim. test ( textUntilPosition ) &&
102+ ! textUntilPosition . endsWith ( "= '" ) ) ) &&
103+ ! isWhitespaceOnly
93104 ) {
94105 return {
95106 suggestions : getTableCompletions ( {
@@ -102,16 +113,6 @@ export const createSchemaCompletionProvider = (
102113 }
103114 }
104115
105- // get text value in the current line
106- const textInLine = model . getValueInRange ( {
107- startLineNumber : position . lineNumber ,
108- startColumn : 1 ,
109- endLineNumber : position . lineNumber ,
110- endColumn : position . column ,
111- } )
112- // check if `textInLine` contains whitespaces only
113- const isWhitespaceOnly = / ^ \s * $ / . test ( textInLine )
114-
115116 if (
116117 / (?: ( S E L E C T | U P D A T E ) .* ?(?: (?: , (?: C O L U M N ) ? ) | (?: A L T E R C O L U M N ) ) ? (?: W H E R E ) ? (?: B Y ) ? (?: O N ) ? (?: S E T ) ? $ | A L T E R C O L U M N ) / gim. test (
117118 textUntilPosition ,
0 commit comments