Open samhh opened 2 years ago
This'd also make golden test output diffs more legible.
I guess one way to implement this would be to convert the JS Compiler
from Reader Cfg
to RWS Cfg () State
where State
tracks indent level. Then wherever there's an indentable block, like opening a function body in a switch statement, we call a helper indent :: Compiler a -> Compiler a
which increments the state, compiles the contents with indentation, and then decrements on the way back out - similar to withPluralCtx
in Intlc.Parser
.
Edit: Can use Reader
local
for this, see #173.
It's all on a single line at the moment. We'll probably run Prettier against it in web, but ideally the output would be more legible out of the box.