Skip to content

Commit

Permalink
fix #4474
Browse files Browse the repository at this point in the history
  • Loading branch information
shinyypig committed Dec 2, 2024
1 parent b388880 commit db813d5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/lint/latex-formatter/tex-fmt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit db813d5

Please sign in to comment.