melomario
Mix-format daemon
Is there anyway to keep “mix format” running and watching files on a specific directory?
I tried to run it automatically whenever I save a file, but it takes some time and I’m that kind of dev that saves pretty much everytime. 
I might be wrong, but I feel that a great deal of the time it takes to format the file is related to starting mix up.
Marked As Solved
dbern
I’m not aware of a daemon, but I do know that editors can take advantage of ElixirLS which is a server running in the background (like a daemon I suppose) and perform tasks like formatting your code. You can adjust settings in your editor to format on save or on-demand. Might be faster to use ElixirLS than spinning up mix to format each time.
Which editor do you use?
Also Liked
hauleth
stefanchrobot
Here’s what I’m using (auto format and re-run affected tests):
watchexec -e 'ex,exs,eex,leex' -- 'mix format && mix test --stale'
You need to configure your editor to properly pick up external changes automatically and not nag you with a popup.
NobbZ
slouchpie
if you have a program like say or speak, you can do really fun stuff like:
ls **/*.{ex,exs,heex} | entr sh -c "mix format; mix test && say 'tests all green' || say 'we have a problem, some test failed'"







