Skip to content

Instantly share code, notes, and snippets.

@Frost
Created December 1, 2017 12:35
Show Gist options
  • Save Frost/4a4a39aea47e0a930650711850cb1bfd to your computer and use it in GitHub Desktop.
Save Frost/4a4a39aea47e0a930650711850cb1bfd to your computer and use it in GitHub Desktop.
mix format inline pipe?

When I run mix format on this code:

defmodule FormatExample do
  @some_module_attribute %{}

  def format_this do
    foo = @some_module_attribute |> Map.put("bar", "blargh") |> some_function([{"baz", [:something_long_enough]}])
  end
end

I get this output:

defmodule FormatExample do
  @some_module_attribute %{}

  def format_this do
    foo =
      @some_module_attribute |> Map.put("bar", "blargh")
      |> some_function([{"baz", [:something_long_enough]}])
  end
end

I would perfer if there was a line break for each pipe, like so:

defmodule FormatExample do
  @some_module_attribute %{}

  def format_this do
    foo =
      @some_module_attribute
      |> Map.put("bar", "blargh")
      |> some_function([{"baz", [:something_long_enough]}])
  end
end

Is this possible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment