-
Notifications
You must be signed in to change notification settings - Fork 25
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
Format using JuliaFormatter.jl #56
Conversation
First, I'd like to see examples of code that Second, if we were to include this patch, I think we need to make its dependencies opt-in. Remember how you guys had to drag me kicking and screaming to include CSTParser? And that was just two dependencies. JuliaFormatter pulls in dozens. I'd like to put together a Snail-configuration optional way to enable features which require Julia dependencies. (Basically an Emacs-side list of Julia packages, which, if set, will tell Snail to use |
Thanks for your feedback! As to your first point: JuliaFormatter.jl is much more extensive in the changes it makes, but I don't think there's anything there that couldn't in principle be replicated in emacs. It has the advantage of being easy to customise on a per-project basis and also already there. I personally don't care about the particular position of semicolons but I know some organisations enforce style guides. I just knocked this feature together because a collaborator prefers consistent style in a package. If nothing else this PR can serve as a model for how easy it is to extend julia-snail, thanks to the transparent client-server model. |
Okay. I'm convinced. I have in mind a pure Snail-side solution for the dependency problem. Basically, as I described above: some features in Snail will be gated by an opt-in I think this'll help a lot with adding features with your point (b) above. I don't have time to work on that right now, but maybe in a few weeks. |
All right, sounds good! |
I thought a lot about what you said, and implemented the idea of Snail extensions to make things like this easier to write and maintain:
I grabbed your code (cherry-pick commit here: 69cd68a) but moved things around to fit the extensions API I put together. It's here: https://github.com/gcv/julia-snail/tree/master/extensions/formatter Let me know what you think! |
Wonderful, thanks! I'll give it a try and let you know. |
Some functionality for using JuliaFormatter.jl, which offers more sophisticated formatting than julia-mode at the moment, and is useful for following style guides. Inspired by julia-formatter.el.
This PR provides julia-snail-format-region and julia-snail-format-buffer. Default style can be changed by providing a config file
as per JuliaFormatter docs.