You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally from a Discord thread. @avh4’s response there:
Yeah, I'm open to PRs for that! See
lenient parser
for some of the other ideas that have been documented.
The main concern is to make sure that it doesn't make the parser start doing a lot of backtracking, and to make sure that the grammar remains unambiguous and that it doesn't change the parsing of any valid Elm files
I’m creating an issue for tracking.
Here’s the idea:
What if elm-format could parse and format incomplete Elm code?
case thing of with 0 branches
letin with 0 declarations
case branches with nothing after the ->
let bindings or top-level declarations with nothing after =
if with nothing between then and else, or nothing after else
and whatever else we can think of where the grammar says “there should be a <thing> after the <symbol>” but the <thing> is missing so far, or “there should be one or more <thing> in <construct>” but there are zero so far.
The idea here is that while writing out new pieces of code (where parts are left to fill in yet), you don’t lose formatting.
I have learned to put placeholders like x, ä or TODO all over the place while writing code so that “I don’t lose elm-format”. But sometimes I forget and then it feels like elm-format (on save) stopped working until I realize “oh, I must have left a syntax error behind somewhere”.
The text was updated successfully, but these errors were encountered:
Originally from a Discord thread. @avh4’s response there:
I’m creating an issue for tracking.
Here’s the idea:
What if elm-format could parse and format incomplete Elm code?
case thing of
with 0 brancheslet
in
with 0 declarations->
=
if
with nothing betweenthen
andelse
, or nothing afterelse
<thing>
after the<symbol>
” but the<thing>
is missing so far, or “there should be one or more<thing>
in<construct>
” but there are zero so far.The idea here is that while writing out new pieces of code (where parts are left to fill in yet), you don’t lose formatting.
I have learned to put placeholders like
x
,ä
orTODO
all over the place while writing code so that “I don’t lose elm-format”. But sometimes I forget and then it feels like elm-format (on save) stopped working until I realize “oh, I must have left a syntax error behind somewhere”.The text was updated successfully, but these errors were encountered: