> the Elixir formatter does not change the AST by default

Ah, this makes sense. The whitespace in a sigil is part of the AST (unlike, 
say, a list literal) so it must stay put.

It feels like that this soft guarantee is *not* exactly upheld by the 
formatter's treatment of heredoc strings, which it does rewrite; but on the 
other hand the compiler does emit warnings about misdented heredoc lines, 
and other subtleties, so that kind of makes sense.

> Elixir could add rules to format its own sigils, but they would have to 
be opt-in.

In that case, it feels effectively equivalent to just publish some stdlib 
sigil formatters outside core as a library, then "opt in" by adding to 
one's deps and .formatter.exs plugins list. I might take a whack at that, 
if I can put together a PR to mix that passes column metadata about a sigil 
into a custom formatter's opts (alongside file and line no) as I think this 
is required for them to take indentation into consideration.

> A pipeline is always indented according to the argument it applies to.

> But we added a rule that, if the right side of operators or the last 
argument of a function call is a list (or a map, or a fn, etc), we can skip 
the newline and the indentation.

I do view the result of applying these two rules to module attributes 
pipelines as unfortunate, but internally consistent... 

> but it leads to two different formats in cases you have a pipeline and so 
on.

Are there other common cases where this happens, off the top of your head? 
I might investigate what it'd take to special-case them, if there is a 
sensible way to do so for reasonable gain.

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/0a21e45a-1183-4263-a405-253083b37f95n%40googlegroups.com.

Reply via email to