-
Notifications
You must be signed in to change notification settings - Fork 832
Keep track of EQUALS range in Syntax Tree #12311
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
Conversation
|
Are ranges actually needed? Wouldn't positions be enough? (Also thinking about other similar cases like dots positions in other nodes) |
|
Yes, because you can't assume the equals sign is on the same line: type TypeWithLongCurriedMethods() =
member _.LongMethodWithLotsOfCurriedParams
(aVeryLongParam: AVeryLongTypeThatYouNeedToUse)
(aSecondVeryLongParam: AVeryLongTypeThatYouNeedToUse)
(aThirdVeryLongParam: AVeryLongTypeThatYouNeedToUse)
= // some great comment
() |
880a3ff to
6187d0a
Compare
I'm sorry, I don't quite get it. 🙂 |
|
Nope, my bad, I misunderstood your question. You are right, we could get away with using the start position. However, this is a bit less convenient overall. Is there a helper function to only get the start pos in |
I'd expect it to be |
OK, thanks |
In recovery cases and I believe there is one case where a SynBinding eventually is transformed to a DoExpr. Lines 2614 to 2626 in 196a277
|
Oh, sometimes I wish we started refactoring such places, so some nodes aren't reused like this. 🙂 |
6187d0a to
740d1ec
Compare
…igDecl.NestedModule.
|
@dsyme ready for review. |
dsyme
left a comment
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.
Just a few minor things - perhaps go over the diff and apply consistently throughout, e.g. I think we almost always use id=id in pattern case selectors
|
@dsyme I've addressed all the feedback. |
|
This is great work! |
I'd like to keep track of the range of the equals token in the Syntax tree.
This is useful for Fantomas to reconstruct code comments (trivia) after equal signs.
The closest element to assign the comment, in this case, is the equal token and it is beneficial to have this information in the Syntax tree.
I have in mind to add it to: