Skip to content
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

Fix folding ranges for nested switch statements #2794

Merged
merged 1 commit into from
Aug 15, 2023

Conversation

hopehadfield
Copy link
Contributor

Fixes redhat-developer/vscode-java#2751

Normal (not collapsed):
Screenshot from 2023-08-10 16-06-11

Before fix:
Screenshot from 2023-08-10 16-09-58

After fix:
Screenshot from 2023-08-10 16-06-34

@hopehadfield hopehadfield force-pushed the 2751-folding branch 2 times, most recently from e42333a to d1fe4f9 Compare August 10, 2023 20:14
@rgrunber
Copy link
Contributor

test this please.

@rgrunber rgrunber added this to the End August 2023 milestone Aug 14, 2023
@rgrunber rgrunber self-requested a review August 14, 2023 19:12
@rgrunber
Copy link
Contributor

rgrunber commented Aug 14, 2023

Also, this isn't related to your change, but for the block regarding // Start & end overlap, adjust the previous one for visibility:, I would add a comment explaining it handles specifically try/catch if/else if where the curly brace that ends one expression is on the same line as the start of the other expression, where both are candidates to be folded.

Update: I mean it may become related to your change as I assume you'll have to update that block to deal with an annoying overlap :)

@rgrunber
Copy link
Contributor

retest this please.

Copy link
Contributor

@rgrunber rgrunber left a comment

Choose a reason for hiding this comment

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

Change looks good to me. I was a bit iffy on ignoring the curly braces within the case statement, but we did that even before, so we may as well continue the practice since it also makes it simpler.

Reversing the candidate mapping also makes sense given that the starting line of a folding range is unique, and not the ending line (folding ranges could end on the same line).

@rgrunber rgrunber merged commit 5d4c9ee into eclipse-jdtls:master Aug 15, 2023
4 checks passed
@hopehadfield hopehadfield deleted the 2751-folding branch August 22, 2023 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nested switch collapsing broken
2 participants