Skip to content

Conversation

roife
Copy link
Member

@roife roife commented Apr 9, 2025

Inspired by #18924, a follow-up to #17542.

This PR adds a new feature that highlights the related return values when the cursor is on match, if, or a match arm arrow (=>). This helps users quickly identify the different possible outcomes of control flow expressions.

For match keyword:

  • The match keyword itself
  • All return expressions in each arm of the match

For => (match arm arrow):

  • The arrow itself
  • The return expression for that specific arm

For if keyword:

  • All if keywords in the if-else chain
  • All return expressions in the if-else branches

This feature works with nested expressions and macros.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 9, 2025
@roife
Copy link
Member Author

roife commented Apr 9, 2025

Here's a demo.

2025-04-09.10.32.29.mov

@roife roife force-pushed the branch-value-highlights branch from 8fb7504 to 6d3a9e1 Compare April 9, 2025 08:29
@roife roife force-pushed the branch-value-highlights branch 2 times, most recently from 335d67b to e23e442 Compare April 17, 2025 17:06
@Veykril Veykril added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 5, 2025
@roife roife force-pushed the branch-value-highlights branch from e23e442 to 6f81f9f Compare May 26, 2025 07:25
@roife roife force-pushed the branch-value-highlights branch from 6f81f9f to 15e70c2 Compare June 26, 2025 05:43
@roife
Copy link
Member Author

roife commented Jun 26, 2025

I've been busy with work lately... Apologize for the delayed response.

Copy link
Member

@Veykril Veykril left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@Veykril Veykril added this pull request to the merge queue Jun 26, 2025
Merged via the queue into rust-lang:master with commit 560f235 Jun 26, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants