Separate the field access function from an operator automatically #677
Labels
0.9
(temporary label for search filtering)
feature for developers
full operators list
Features that require knowledge of the complete list of defined operators
Milestone
Quite often, I write code similar to the following:
which then gets reformatted to
which does not compile, because
|>.
is not a known operator.This is "syntactically" the correct change, as even in the first case, the code does not compile for the same reason.
Since
elm-format
likes to fix syntax errors to help the user out without them noticing, I thought maybe it could also help them by reformatting to the following instead:I think the same thing would be worthwhile for
<|
,<<
,>>
, and potentially all operators.This is my proposal:
When seeing code of the form
<known operator>.<valid field name>
, reformat it to<known operator> .<valid field name>
.AFAIK, there is only
|.
fromParser
andParser.Advanced
which ends with a.
, but since|
is not a known operator, this wouldn't be ambiguous.Since the number of operators is limited and has been stable for quite a while now, I think it would be reasonably safe to fix it the proposed way but you may righteously disagree, and that would be a good reason to decide against this proposal 👍
Thanks for all your work on
elm-format
! ❤️The text was updated successfully, but these errors were encountered: