Formatter: keep functions grouped?

Is there a formatter option that groups same-arity functions grouped (or at least abstains from inserting a newline from already grouped functions)?

F.e. I’d like to have, or at least keep, a/2 below grouped together:

defmodule A do
  def a(a1,[]) do
  end
  def a(a1,a2) do   # DO NOT insert newline here
  end
  # DO insert newline here
  def b(b1) do
  # etc.

Search on existing topics comes up short.

There’s not. The elixir formatter doesn’t include many options by design to prevent opportunity for bike shedding. Though I guess with the new plugin functionality you can make it do many more things than it would support by itself.

3 Likes