diff --git a/src/lint/latex-formatter/tex-fmt.ts b/src/lint/latex-formatter/tex-fmt.ts index e146b5d22..19ed042f6 100644 --- a/src/lint/latex-formatter/tex-fmt.ts +++ b/src/lint/latex-formatter/tex-fmt.ts @@ -43,9 +43,13 @@ async function formatDocument(document: vscode.TextDocument, range?: vscode.Rang }) }) - process.stdin?.write(document.getText(range)) + // write the document to the process, and add a newline at the end + process.stdin?.write(document.getText(range)+'\n') process.stdin?.end() const edits = await promise - + // remove extra newline at the end + if (edits) { + edits.newText = edits.newText.replace(/\n$/, '') + } return edits }