-
-
Notifications
You must be signed in to change notification settings - Fork 892
Update with fixes to collapsing nested cases with list tails #5169
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: main
Are you sure you want to change the base?
Update with fixes to collapsing nested cases with list tails #5169
Conversation
b383eef to
5475223
Compare
lpil
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.
Brilliant! Thank you! Few small Qs inline
| } = matched_variable | ||
| { | ||
| // We need to un-nest the list when replacing the tail | ||
| let surrounding_brackets = Regex::new(r"(^\[|\]$)").expect("a valid regex"); |
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 we do this efficiently without regex? It's quite tricky to read this, and we tend not to use it.
If not then the regex will need to be cached in a static variable (currently it is recompiled every time) and it'll need a detailed comment explaining what this does. Thank you.
| .to_string(); | ||
|
|
||
| // We need to also remove the prefix when replacing the variable | ||
| // at the tail of the list |
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.
What does this mean?
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.
Perhaps I could have been more clear... What I meant is that, rather than replacing the span of the variable, we need to use the span from the tail prefix to the end of the variable (prefix_and_variable_span)
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.
I'm sorry, I don't understand. Could you add a detailed comment with examples please 🙏
|
When you are ready for a review please un-draft this PR and tag me for a review. Thank you! |
5475223 to
764d3d3
Compare
22bad62 to
bdd982a
Compare
bdd982a to
2332f28
Compare
Addresses #5168