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.
This formatter uses a script wrapping the JuliaFormatter.jl library. This "formatter script in the plugin" approach hasn't been taken before in
vim-codefmt
, so let me know if you'd prefer a different approach or to reorganize things. (The JuliaFormatter.jl library ships with an executable script, but it only works on file paths (not stdin) and can't handle line ranges. I'm also not sure how to get the path of a bin directory in your Julia environment, which doesn't work like executables in a package management system like npm.)If the user hasn't installed the
JuliaFormatter
package, instructions will point to aninstall
script in the same directory as the formatter script. I've tested the shell version of this script, but don't have a Windows machine to test the.cmd
version.The line-range handling is a bit of a hack: the underlying library doesn't expose this functionality, so I used comments to enable/disable the formatter around relevant blocks. I found some edge case behaviors that I've hopefully documented clearly.
The script will use the same
.JuliaFormatter.toml
files in the parent directory hierarchy of the source file being edited to determine the formatter options like style, indent, and line width. This is the same behavior that running the executable from JuliaFormatter.