Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #4474 #4475

Merged
merged 2 commits into from
Dec 5, 2024
Merged

fix #4474 #4475

merged 2 commits into from
Dec 5, 2024

Conversation

shinyypig
Copy link
Contributor

By adding an extra "\n" at the end of the input text and remove it after using tex-fmt, the problem is solved.

iShot_2024-12-02_10 36 07

Copy link
Owner

@James-Yu James-Yu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution.

src/lint/latex-formatter/tex-fmt.ts Outdated Show resolved Hide resolved

// remove extra newline at the end
if (edits) {
edits.newText = edits.newText.replace(/\n$/, '')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... and remove the new line char accordingly.

@@ -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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is a workaround of an external piece of software, please add corresponding documents describing the date, version of tex-fmt, and the context of the workaround.

@shinyypig
Copy link
Contributor Author

I have corrected the code, but I am unsure whether it is appropriate to write the documentation directly as comments within the code.

@James-Yu James-Yu merged commit 6b37c0d into James-Yu:master Dec 5, 2024
7 checks passed
James-Yu added a commit that referenced this pull request Dec 7, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants