-
Notifications
You must be signed in to change notification settings - Fork 429
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
Pretty print extensions #1703
Pretty print extensions #1703
Conversation
Very cool! Does this work for |
Yes, these are supported, I added them to the test. However, the sugar triggers only in "sequences" (between So when there is only one expression, it falls back to |
So the question remains what should be the printing for a single expression: let x = {
%extend
switch None {
| Some(x) => assert(false)
| None => ()
};
}; let x = [%extend
switch None {
| Some(x) => assert(false)
| None => ()
};
]; let x = (%extend
switch None {
| Some(x) => assert(false)
| None => ()
};
); let x = %extend
switch None {
| Some(x) => assert(false)
| None => ()
}; (I am not sure all cases are unambiguous, I can investigate patching the parser). |
Awesome! Though can we do like ocaml and have |
@chenglou: I agree it would be nice, I will investigate! |
The convenient thing about OCaml's For that Reason, I'm thinking that the prefix syntax you have here would make perfect sense for
Even if ppx extensions use the more "embedded" syntax:
For single expressions, the same lean bracketless ppx attributes would also be awesome:
|
@chenglou: I agree it would be nice, I will investigate! |
Ok, the last update add supports for Plus non negligible simplification to the parser (more to come). |
@let-def Looks like it covers This is really cool! ocamlformat just got extension point sugar support too so pleasantly formatted extension points for everyone! |
@hcarty indeed, thanks I forgot to list that one :). |
This looks amazing - I can't wait to try it out! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank You!
I've wanted this for a long time and so have a lot of other people.
With current version, Reason accepts:
But pretty print it as:
This PR implements pretty-printing for extension sugars (in structures and in expressions).