How to set Elixir 1.6 formatter to add 2 new lines between module functions?

dns_project Source

Is there ability to configure .formatter.exs so formatter does 2 new lines between functions in module? Example:

@spec start_link(String.t()) :: {:error, String.t()} | {:ok, pid()}
def start_link(url) do
   Agent.start_link(fn -> %Links{url: url, remaining: [url]} end)
end
# 2 lines
# 
@spec has_more_links?(pid()) :: boolean()
def has_more_links?(agent_pid) do
   length(get_remaining_links(agent_pid)) > 0
end

Thank you!

elixirformatter

Answers

answered 6 days ago Dogbert #1

This isn't supported at the moment. The documentation says:

The formatter respects the input format in some cases. Those are listed below:

  • ...

  • Newlines inside blocks are kept as in the input except for: 1) expressions that take multiple lines will always have an empty line before and after and 2) empty lines are always squeezed together into a single empty line

  • ...

comments powered by Disqus