This repository has been archived by the owner on Oct 14, 2023. It is now read-only.
Create an actual diff of the formatting changes #19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I had to open a new pull request, but this one finally seems to be working as intended. In particular, it works with format-on-save turned on (which was broken with my last attempt).
Fixes #5. Fixes #12. Fixes #15. Fixes #16.
TextEdit
objects describing theformatting change to the file. The Python extension this code is
based off of obtains a unified diff from the formatting tool, and
constructs a
TextEdit
array from this. Because JuliaFormatter.jldoes not produce diff output by default, we have to do it ourselves.
reads julia code from stdin, and writes the formatted code to
stdout. The typescript process then creates the requisite diff,
formats it, and sends it back to vscode.
transformations (unified diff to ParsedDiff to TextEdit array), so
a future optimization would be to create a TextEdit array directly
from the comparison of the two files. Alternatively,
JuliaFormatter.jl could be updated to output a unified diff upon
request.