Closed minhajuddin closed 7 years ago
I think this is one of those cases where you have to fix the comments manually after running the formatter.
This is documented as intentional: https://github.com/elixir-lang/elixir/blob/master/lib/elixir/lib/code.ex#L291-L329
We are now keeping the struct over multilple lines but the comments will be moved out, yes. :)
Btw, this was added to master at some point. The code above will be formatted to:
defmodule Request do
defstruct uri: %URI{},
method: :get,
http_version: :http1_1,
# e.g. [{"User-Agent", "Danny"}, {"Accept", "text/html"}]
headers: [],
# iodata/iolist
body: []
end
Code formatter re arranges comments in structs which causes loss of context
Environment
Current behavior
Before formatting my code looks like below:
After formatting my code looks like below:
Expected behavior
As you can see the comments are moved from their place to the top of the struct definition. This causes in the loss of context