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

Using JuliaFormatter as an executable (for usage with ALE) #483

Open
AndreasAZiegler opened this issue Sep 30, 2021 · 4 comments
Open

Using JuliaFormatter as an executable (for usage with ALE) #483

AndreasAZiegler opened this issue Sep 30, 2021 · 4 comments

Comments

@AndreasAZiegler
Copy link

I'm using ALE for linting and fixing for C++ and Python. I would love to use JuliaFormatter with ALE as well. As far as I understand it, JuliaFormatter has to be run as a single executable to make it work with ALE.

@domluna
Copy link
Owner

domluna commented Oct 3, 2021

you might be able to make it work if include it with PackageCompiler

@AndreasAZiegler
Copy link
Author

Thanks for your input @domluna. Could you elaborate a bit more what you mean? According to this description about PackageCompiler there are three ways how to use it. Which approach do you mean?

@domluna
Copy link
Owner

domluna commented Oct 9, 2021

@kdheepak may know more about this since he was something similar working for the vim plugin

@dpaetzel
Copy link
Contributor

dpaetzel commented Nov 1, 2024

I case other people find it helpful, I'm building a binary using this command

julia --project=. --startup-file=no -e 'using PackageCompiler; create_app(".", "compiled"; precompile_execution_file="src/other/precompile.jl", force=true)'

In order for that to work you likely first have to add PackageCompiler like so:

julia --project=. -e 'using Pkg; Pkg.add("PackageCompiler")'

The created binary then lies in compiled/bin/JuliaFormatter and can be called as path/to/repo/compiled/bin/JuliaFormatter somefile.jl to (very quickly) in-place format somefile.jl.

Note that I had to perform two minor fixes to get it working, though, which can be seen here.

(I'm still on v1.0.62 right now due to the issues with v2.)

#105 is also related, I guess.

I then hooked this up to my Emacs so that upon saving the current file is formatted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants