Trim whitespace from completion suggestions in CompletionService

This commit is contained in:
Ahmet Ildirim 2025-04-03 19:13:35 +02:00
parent a72a211f48
commit b1cd150ec6

View file

@ -71,7 +71,8 @@ export default class CompletionService {
private async *complete(editor: Editor, provider: Provider, prompt: string, options: CompletionOptions): AsyncGenerator<Suggestion> {
this.notifyCompletionStatus(true);
for await (const text of provider.generate(editor, prompt, options)) {
yield { text };
// trim the text to remove any leading or trailing whitespace
yield { text: text.trim() };
}
this.notifyCompletionStatus(false);
}