Skip to content

Jsx ast #7286

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

Merged
merged 107 commits into from
Apr 4, 2025
Merged

Jsx ast #7286

Changes from 1 commit
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
db7eee6
Intial exploration of JSX ast
nojaf Feb 6, 2025
28aa287
Initial mapping from0
nojaf Feb 24, 2025
b57f2df
Format code
nojaf Feb 24, 2025
32161a3
Merge branch 'master' into jsx-ast
nojaf Mar 3, 2025
d714829
Fix jsx fragment mapping
nojaf Mar 3, 2025
e27b339
Remove fragment
nojaf Mar 3, 2025
92657ee
Update test output
nojaf Mar 3, 2025
441de6e
Introducing Pexp_jsx_unary_element & Pexp_jsx_container_element
nojaf Mar 6, 2025
bf1b411
Refactor fragment transformation.
nojaf Mar 6, 2025
5fe5f12
Initial transform of Pexp_jsx_unary_element in automatic mode
nojaf Mar 7, 2025
9251609
Make props for unary element in automatic mode.
nojaf Mar 7, 2025
1aaa686
Initial custom component unary tag
nojaf Mar 8, 2025
b374212
lowercase container element with children.
nojaf Mar 8, 2025
c91aeda
Uppercase container elements
nojaf Mar 8, 2025
85ccab4
Streamline automatic element calls
nojaf Mar 9, 2025
86c9f5f
lowercase container element in classic mode
nojaf Mar 9, 2025
0dfd5b6
Deal with uppercase tags in classic mode.
nojaf Mar 10, 2025
203ff25
Remove old code
nojaf Mar 10, 2025
a273f2e
Improve recovery of incomplete jsx tags.
nojaf Mar 11, 2025
998edbe
Correct range of incomplete jsx elements
nojaf Mar 11, 2025
fcf2d90
Update semantic tokens
nojaf Mar 11, 2025
162b7a2
Make the closing tag optional for jsx_container_element.
nojaf Mar 11, 2025
9b815a0
Add tighter pattern match for edge case in jsx props completion.
nojaf Mar 11, 2025
9408d06
Update analysis tests for jsx elements ast.
nojaf Mar 11, 2025
cc5beb4
print_jsx_unary_tag
nojaf Mar 11, 2025
02e9fc9
Merge branch 'master' into jsx-ast
nojaf Mar 11, 2025
5e060ea
Rough print_jsx_container_tag
nojaf Mar 12, 2025
e57ab30
Add ml printing
nojaf Mar 12, 2025
b6407d0
Wing the sexp thing
nojaf Mar 17, 2025
e565ca7
First step towards ast mapping
nojaf Mar 18, 2025
84e9cbe
prop punning conversion
nojaf Mar 19, 2025
bbfe816
Map prop value
nojaf Mar 19, 2025
63fc87b
Map prop spreading
nojaf Mar 19, 2025
d6c9fa8
Initial container element mapping.
nojaf Mar 19, 2025
e446ae1
Try support children spreading
nojaf Mar 19, 2025
5fef337
Only print space when there are props
nojaf Mar 19, 2025
251244b
Add space after children.
nojaf Mar 19, 2025
aec0d8e
Restore braces in props and children
nojaf Mar 20, 2025
6a3f4c9
Inline is_jsx_expression and remove old code
nojaf Mar 21, 2025
506dda3
Better indentation of children
nojaf Mar 21, 2025
96839f4
Handle unary tag
shulhi Mar 21, 2025
ff1bb65
Refactor
shulhi Mar 21, 2025
91c283e
WIP: Fix unary tag comments handling
shulhi Mar 22, 2025
2b9b5ce
Fix comments inside prop expression
shulhi Mar 22, 2025
0133f91
Formats
shulhi Mar 22, 2025
aaef8ac
Fix closing tag indentation
shulhi Mar 22, 2025
b863888
Fix closing tag indentation for cases with break vs inline
shulhi Mar 22, 2025
7f8bf01
Handle some edge cases
shulhi Mar 22, 2025
4e0951c
Refactor
shulhi Mar 22, 2025
7843795
Merge pull request #3 from shulhi/shulhi-jsx-ast
nojaf Mar 22, 2025
9e68c1a
WIP: Handle punning
shulhi Mar 22, 2025
53616a7
Fix optional printing with braces
shulhi Mar 22, 2025
25e20b8
WIP: Handle comments attachment in a different way
shulhi Mar 23, 2025
ad72bf2
Handle empty props
shulhi Mar 23, 2025
7ba4996
Handle props spread
shulhi Mar 24, 2025
f09cd70
Fix optional with punning
shulhi Mar 24, 2025
aa1d978
Merge pull request #4 from shulhi/shulhi-jsx-ast-2
nojaf Mar 24, 2025
0ee7601
Indent props if they don't fit on one line.
nojaf Mar 24, 2025
bd45146
Fix indentation of children when props are multiline.
nojaf Mar 24, 2025
2d50ff8
Refactor to Pexp_jsx_element
nojaf Mar 26, 2025
fcabcff
Merge branch 'master' into jsx-ast
nojaf Mar 26, 2025
ddcdaa2
Don't always append make when uppercase component
nojaf Mar 26, 2025
52ecf03
Use Doc.line for child spreading
nojaf Mar 26, 2025
cd9059f
Exotic prop name
nojaf Mar 26, 2025
2e9fb66
Don't create record if only spreading prop, use that expression instead.
nojaf Mar 26, 2025
37755ae
Key prop can be optional
nojaf Mar 27, 2025
3a434c9
Keep comment after opening greater than
nojaf Mar 27, 2025
6cf1e71
Print prop value with comments
nojaf Mar 27, 2025
ae9b428
Update generic jsx completion tests
nojaf Mar 27, 2025
f3b96df
Revert isJsxComponent
nojaf Mar 27, 2025
b1f8dfe
Assign comment to the opening element tag name.
nojaf Mar 29, 2025
64001e2
Attach comments to closing > and closing tag
nojaf Mar 30, 2025
8148cf5
Extract helpers to parsetree_viewer
nojaf Mar 30, 2025
cfc4669
setup to walk jsx props
nojaf Mar 30, 2025
2946ea0
Correct range for prop spreading
nojaf Mar 30, 2025
4fcc3ce
Complete walk_jsx_prop
nojaf Mar 30, 2025
161b12c
Finish comment assignment for container elements
nojaf Mar 30, 2025
cd98c9f
Revisit comment attachment for unary tags
nojaf Mar 30, 2025
67da647
Improve behaviour for comments in unary tag
nojaf Mar 31, 2025
86fea57
Keep location as is for prop spreading
nojaf Mar 31, 2025
f10bc55
print leading comments of closing unary token
nojaf Mar 31, 2025
b40c019
Attach comments between empty container tag
nojaf Mar 31, 2025
28497d2
comments between opening and closing tag
nojaf Mar 31, 2025
e7bf344
Correct opening_greater_than_doc
nojaf Mar 31, 2025
b8d609e
Deal with container element comment edge cases.
nojaf Mar 31, 2025
6d15369
Ensure comments inside braced property values are correct.
nojaf Mar 31, 2025
88534ba
More accurate locations
nojaf Mar 31, 2025
210fa87
Update syntax roundtrip test files
nojaf Mar 31, 2025
8373814
Update mapping test results
nojaf Mar 31, 2025
d92d7c5
comment after prop name
nojaf Mar 31, 2025
d9b59dd
For them older camls
nojaf Mar 31, 2025
4e160f3
More older caml stuff
nojaf Mar 31, 2025
93eb5af
Remove unreached code in typecore
nojaf Apr 1, 2025
6152b83
Remove leftover comments
nojaf Apr 1, 2025
2126fc9
Preserve lines between jsx elements
nojaf Apr 1, 2025
645b244
Preserve newline between jsx children, streamline jsx fragment childr…
nojaf Apr 1, 2025
a0c0d0d
Update analysis expected
nojaf Apr 1, 2025
f1da36f
Another location change in expected
nojaf Apr 1, 2025
80c307a
One more update?
nojaf Apr 1, 2025
5e5dabd
Merge branch 'master' into jsx-ast
nojaf Apr 1, 2025
091f1a3
Merge branch 'master' into jsx-ast
nojaf Apr 2, 2025
11ced99
Remove leftover comments
nojaf Apr 2, 2025
0c825d5
Remove obsolete comment
nojaf Apr 2, 2025
8ff481d
Ensure fragment starts after arrow
nojaf Apr 3, 2025
8723426
Add changelog entry
nojaf Apr 3, 2025
a1e4ca9
Merge branch 'master' into jsx-ast
nojaf Apr 4, 2025
e1ad251
Add missing Pexp_await
nojaf Apr 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
For them older camls
  • Loading branch information
nojaf committed Mar 31, 2025
commit d9b59ddacd72dfc12a98bfe8a7fd3367beff0402
2 changes: 1 addition & 1 deletion compiler/syntax/src/res_printer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -4377,7 +4377,7 @@ and print_jsx_unary_tag ~state tag_name props expr_loc cmt_tbl =
let name = print_jsx_name tag_name in
let formatted_props = print_jsx_props ~state props cmt_tbl in
let tag_has_trailing_comment = has_trailing_comments cmt_tbl tag_name.loc in
let tag_has_no_props = List.is_empty props in
let tag_has_no_props = List.length props == 0 in
let closing_token_loc =
ParsetreeViewer.unary_element_closing_token expr_loc
in
Expand Down
Loading