-
Notifications
You must be signed in to change notification settings - Fork 469
Support doc comment before variant #7535
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
base: master
Are you sure you want to change the base?
Support doc comment before variant #7535
Conversation
1f36000
to
e71246b
Compare
rescript
@rescript/darwin-arm64
@rescript/darwin-x64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/win32-x64
commit: |
d77e5e6
to
1c17940
Compare
| O_CLOEXEC | ||
|
||
| O_KEEPEXEC |
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.
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.
Fine for me!
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.
This is great! 🎉
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.
Ok, I meant the new formatting of doc comments before variants is great.
Regarding the newlines, it would be nice if this was still possible:
type x =
// first group
| A
| B
| C
// second group
| D
| E
| F
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.
Can't you just put an empty comment line where you want the break?
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.
@shulhi, this is better! I wasn't a fan of adjusting the ranges in the parser to satisfy the format. It felt wrong.
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.
This will reformat it to
type x =
// first group
| A
| B
| C
// second group
| D
| E
| F
I can still investigate this if we want to preserve the previous behavior. I actually like it without the newline.
The challenge with preserving the previous behavior has to do with how we treat comments and doc comments (comment table and attribute). If we compare the location for the comment for the above example, first group
is attached to line 3, while it would be at line 2 for doc comment. We would have to adjust the ranges to make it print the same way for both - which felt like a hack.
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.
Ok, that sounds quite hacky indeed.
I guess I can live with no newlines in that case. 🙂
@shulhi this is fantastic, a very needed change! I'll let people more familiar with the parser review, but just wanted to give a thumbs up 👍 |
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.
Looks good, thanks!
| O_CLOEXEC | ||
|
||
| O_KEEPEXEC |
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.
@shulhi, this is better! I wasn't a fan of adjusting the ranges in the parser to satisfy the format. It felt wrong.
8a71372
to
aec4bc7
Compare
Fix for #7534