rebar3_format
rebar3_format copied to clipboard
Option to not rewrite list constructions
In @michalmuskala words:
[1 | []]
and[1]
have exactly the same ASTThat means the formatter won't preserve that source structure, which in some cases might be intentional.
This might be impossible to solve due to ktn_dodger
not returning the text for the whole structure, for complex structures… i.e. when parsing [1]
, the text
property for the list is just "["
.
In the same way as https://github.com/AdRoll/rebar3_format/issues/167#issuecomment-780650290 … erl_syntax:subtrees/1
and other erl_syntax
functions, like list_suffix/1
, cons_suffix/1
, etc… go to great lengths to hide the syntactic information to make stuff like [1, 2 | []]
behave exactly equal to [1 | [2 | []]]
and [1, 2]
. 😢
As time passes and I work on new issues I'm getting more and more convinced that we'll eventually need to move away from the OTP way of parsing Erlang code (i.e. erl_syntax
)…