From eddb7bf1f2213537717ff64162e8429faf59e51c Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Wed, 30 Jul 2025 09:56:39 -0700 Subject: [PATCH] fix: add a newline accordingly --- .../templating/mercuryCoderNextEdit.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/core/nextEdit/templating/mercuryCoderNextEdit.ts b/core/nextEdit/templating/mercuryCoderNextEdit.ts index a7f79962b..616700b17 100644 --- a/core/nextEdit/templating/mercuryCoderNextEdit.ts +++ b/core/nextEdit/templating/mercuryCoderNextEdit.ts @@ -5,16 +5,16 @@ import { insertCursorToken } from "./utils"; export function recentlyViewedCodeSnippetsBlock( recentlyViewedCodeSnippets: { filepath: string; content: string }[], ) { - return [ - recentlyViewedCodeSnippets.reduce((acc, snippet) => { - const block = [ - `code_snippet_file_path: ${snippet.filepath}`, - snippet.content, - ].join("\n"); + return recentlyViewedCodeSnippets.reduce((acc, snippet, i) => { + const block = [ + `code_snippet_file_path: ${snippet.filepath}`, + snippet.content, + ].join("\n"); - return acc + block; - }, ""), - ].join("\n"); + return ( + acc + block + (i === recentlyViewedCodeSnippets.length - 1 ? "" : "\n") + ); + }, ""); } export function currentFileContentBlock(