-
Notifications
You must be signed in to change notification settings - Fork 230
Ensure the last line is included in projection-based visible regions #3585
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
Open
danthe1st
wants to merge
1
commit into
eclipse-platform:master
Choose a base branch
from
danthe1st:visible-region-missing-last-line
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Ensure the last line is included in projection-based visible regions #3585
danthe1st
wants to merge
1
commit into
eclipse-platform:master
from
danthe1st:visible-region-missing-last-line
+76
−13
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
This was referenced Dec 15, 2025
c0dc874 to
e3ed532
Compare
Contributor
Author
|
@akurtakov Would you like to review that since it seems like this also impacts lsp4e? Other than that, I think it would be good to get a review on #3456 if possible. |
e3ed532 to
f719e33
Compare
This change ensures that setting the visible region with projections enabled does not hide the last line in case there is additional text at the end of the line or the file is using Windows line endings.
f719e33 to
2767a44
Compare
Contributor
Author
|
@iloveeclipse @akurtakov Could this (and also #3456) please be reviewed? (The recent changes are just rebasing and updating copyright headers) |
Contributor
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As noticed in #3074 (comment) by @totomomo18, there are situations where the projection-based folding introduced in #3074 hides the last line where it should be shown. In that example, it was due to Windows line endings (
\r\n) where the last line was missing and it only moved past the\rbut not the\n(it didn't account for the second character).However, there is another situation where this can happen which is the case if there is additional (non-whitespace) text in the last line after the visible region. In the following example, assume that the visible region starts with
{and ends with}:Here, the
}would be hidden.An example where this could happen with JDT is enum constants (because of the
,after the constants):The problem with these situations is that projections/folding cannot hide partial lines at the end so it has to show the entire last line. When I implemented #3074, I was assuming that this was an issue with whitespace at the end but I didn't account for further text (it worked perfectly fine with comments and other things in JDT because comments at the end seem to be included in the visible regions set by JDT).
This change ensures that setting the visible region with projections enabled does not hide the last line in case there is additional text at the end of the line or the file is using Windows line endings by fixing the logic for computing the end of the visible region.