Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prettified codegen #5

Open
samhh opened this issue Jan 14, 2022 · 2 comments
Open

Prettified codegen #5

samhh opened this issue Jan 14, 2022 · 2 comments

Comments

@samhh
Copy link
Member

samhh commented Jan 14, 2022

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.

@samhh
Copy link
Member Author

samhh commented Feb 7, 2022

This'd also make golden test output diffs more legible.

@samhh
Copy link
Member Author

samhh commented Feb 7, 2022

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.

@samhh samhh removed the discussion label Jun 23, 2022
@samhh samhh changed the title Output formatting JSON formatting Jun 23, 2022
@samhh samhh changed the title JSON formatting TS formatting Jun 23, 2022
@samhh samhh changed the title TS formatting Prettified codegen Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant