-
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
Fix1736 #1745
Fix1736 #1745
Conversation
282f7c1
to
8200ba8
Compare
This seems unfortunate. Could we make it context dependent instead? |
Great! So, if we convert some code from OCaml to Reason that uses |
Per discussion with @chenglou, braces are printed around JSX as jsx-arguments: <Description term={<Text text="Age" />}> ... </Description>;
<Foo bar={<Baz />} /> The infix operators are preserved this way, also added tests, and it's a bit more familiar for JS-developers. |
Why don’t we use normal () braces? Those curly braces look ugly |
@thangngoc89 mostly for familiarity with existing JSX, and to reduce the amount of parentheses. |
To reduce the number of parens, we could print them as |
@@ -2452,6 +2452,26 @@ let is_direct_pattern x = x.ppat_attributes = [] && match x.ppat_desc with | |||
| Ppat_construct ( {txt= Lident"()"}, None) -> true | |||
| _ -> false | |||
|
|||
let isJSXComponent loc args = |
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.
Probably worth pulling out JSX logic into its own module in the future.
Thank you again! Merged. |
Fixes #1736
This PR adds printing of braces around JSX as JSX-arguments:
Error messages for ambiguous cases are also provided:
![captura de pantalla 2018-01-12 a las 21 35 02](https://user-images.githubusercontent.com/10634678/34894430-b1d66612-f7e1-11e7-8382-39936fbc9744.png)
![captura de pantalla 2018-01-12 a las 21 35 57](https://user-images.githubusercontent.com/10634678/34894436-b6743226-f7e1-11e7-9797-6a89943d62d0.png)