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

Incremental formatting? #10

Open
michalrus opened this issue Apr 10, 2017 · 1 comment
Open

Incremental formatting? #10

michalrus opened this issue Apr 10, 2017 · 1 comment

Comments

@michalrus
Copy link

Maybe we could have incremental formatting? I.e. when run for a directory, reformatting only the files with updated times (since last formatting)?

Here’s an example of how to do that with a plain old Makefile:

https://github.com/michalrus/kornel/blob/5c99123afcbb04b555570093c0d5fad0cf7edf23/Makefile#L33-L41

So for each %.hs file, it touches an empty dist/autoformat/%.hs_autoformat. And reformats only these files for which %.hs has time fresher than dist/autoformat/%.hs_autoformat.

Something like that would be very cool. ♥

@danstiner
Copy link
Owner

danstiner commented Jun 18, 2017

Neat approach, I assume the problem is how slow it is to run a format (it is indeed quite slow). Several things could be done to speed it up some, but I agree the best solution is to only run it on the files that actually might need it.

I would be open to including such logic in this tool if you'd like to send a PR :) but I'm not writing much Haskell lately so I probably won't be getting around to it personally anytime soon. I actually think such logic would be re-usable by other tools and would be great as a separate library.

Currently I enjoy having some plugins set up in my editor to run stylish-haskell on save and show suggestions from hlint and then manually run hfmt before check-in. For the Atom editor see ide-haskell.

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

No branches or pull requests

2 participants