Skip to content

Commit 4b5db40

Browse files
committed
Remove non-letter and 1-letter suggestions from empty select clause
1 parent 51ebcfd commit 4b5db40

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/server/src/complete/complete.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@ class Completer {
245245
this.addCandidatesForSelectStar(fromNodes, schemaAndSubqueries)
246246
const expectedLiteralNodes =
247247
e.expected?.filter(
248-
(v): v is ExpectedLiteralNode => v.type === 'literal'
248+
(v): v is ExpectedLiteralNode =>
249+
v.type === 'literal' && hasAtLeastTwoLetters(v.text)
249250
) || []
250251
this.addCandidatesForExpectedLiterals(expectedLiteralNodes)
251252
this.addCandidatesForFunctions()
@@ -428,3 +429,7 @@ export function complete(
428429
console.timeEnd('complete')
429430
return { candidates: candidates, error: completer.error }
430431
}
432+
433+
function hasAtLeastTwoLetters(value: string): boolean {
434+
return /[a-zA-Z].*[a-zA-Z]/.test(value)
435+
}

0 commit comments

Comments
 (0)