Skip to content

Fix overlapping folding ranges.#7716

Merged
sean-mcmanus merged 4 commits intomainfrom
seanmcm/fixFoldingRange
Jun 18, 2021
Merged

Fix overlapping folding ranges.#7716
sean-mcmanus merged 4 commits intomainfrom
seanmcm/fixFoldingRange

Conversation

@sean-mcmanus
Copy link
Contributor

Fixes #5521

image

@Colengms Is there some problem/bug with this fix and/or a reason this wasn't done initially?

@sean-mcmanus sean-mcmanus requested review from a team and Colengms June 17, 2021 19:57
@Colengms
Copy link
Contributor

Colengms commented Jun 18, 2021

@sean-mcmanus This seems to be related to: #5521 Currently, it's by design that we collapse the entire line containing the closing bracket. Having the fold take as few lines as possible when collapsed (similar to VS) was desired. Also, if we did not include the last line, code immediately preceding a closing brace would not get included in the fold.

	if (i == 0) {
		i = 1 
		j = 2 }

But, not including the last line only when overlapping the start of another folding range, seems OK to me.

@sean-mcmanus
Copy link
Contributor Author

Ah, I see, it behaves unideally when

if (i == 0) {
    i = 1 
    j = 2 } else {
    return 0;
}

is used; however, that seems like more desirable behavior than the pre-existing one which hides the else/else if, which is likely very important for the user to see and not be collapsed.

@sean-mcmanus sean-mcmanus merged commit e0c9020 into main Jun 18, 2021
@sean-mcmanus sean-mcmanus deleted the seanmcm/fixFoldingRange branch June 18, 2021 21:14
@github-actions github-actions bot locked and limited conversation to collaborators Aug 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Code folding will collapse entire line containing closing bracket

2 participants