⚡️ filter out completions that are only punctuation/space
This commit is contained in:
parent
4160ca6b50
commit
2b302d95f0
2 changed files with 9 additions and 0 deletions
|
|
@ -531,6 +531,11 @@ export class CompletionProvider {
|
|||
return undefined;
|
||||
}
|
||||
|
||||
// Filter out unwanted results
|
||||
if (isOnlyPunctuationAndWhitespace(outcome.completion)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Do some stuff later so as not to block return. Latency matters
|
||||
const completionToCache = outcome.completion;
|
||||
setTimeout(async () => {
|
||||
|
|
|
|||
4
core/autocomplete/filter.ts
Normal file
4
core/autocomplete/filter.ts
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
export function isOnlyPunctuationAndWhitespace(completion: string): boolean {
|
||||
const punctuationAndWhitespaceRegex = /^[^\w\d]+$/;
|
||||
return punctuationAndWhitespaceRegex.test(completion);
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue