@@ -144,20 +144,27 @@ export class RdbmsLanguageService {
144
144
145
145
this . pool . runTask ( infoData ) . then ( ( taskId : number , result : ILanguageWorkerResultData ) : void => {
146
146
if ( ! model . isDisposed ( ) && result . completions ) {
147
- const info = model . getWordUntilPosition ( position ) ;
147
+ // Determine what has been written so far, by going back from the current position until we find
148
+ // a whitespace character or the start of the line.
149
+ const line = model . getLineContent ( position . lineNumber ) ;
150
+ let index = position . column - 1 ;
151
+ while ( index > 0 && ! / \s / . test ( line [ index - 1 ] ) ) {
152
+ -- index ;
153
+ }
154
+
148
155
const replaceRange = context . fromLocal ( {
149
156
startLineNumber : position . lineNumber ,
150
- startColumn : info . startColumn ,
157
+ startColumn : index + 1 ,
151
158
endLineNumber : position . lineNumber ,
152
- endColumn : info . endColumn ,
159
+ endColumn : position . column ,
153
160
} ) ;
154
161
155
162
this . transformCompletionItems ( result . completions , replaceRange ) . then ( ( suggestions ) => {
156
163
if ( suggestions . length === 0 ) {
157
164
// Add a special item here if nothing was found.
158
165
// Otherwise we get some meaningless default suggestions.
159
166
suggestions . push ( {
160
- label : "No Suggestions. " ,
167
+ label : "No Suggestions" ,
161
168
kind : languages . CompletionItemKind . Text ,
162
169
range : replaceRange ,
163
170
insertText : "" ,
0 commit comments