-
Notifications
You must be signed in to change notification settings - Fork 229
Allow using visible regions with projections #3074
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
Allow using visible regions with projections #3074
Conversation
48e4b9a to
88d2623
Compare
Test Results 2 778 files ± 0 2 778 suites ±0 1h 36m 42s ⏱️ - 7m 29s For more details on these failures, see this check. Results for commit da38e3d. ± Comparison against base commit 477d106. ♻️ This comment has been updated with latest results. |
|
@danthe1st : thanks for PR, few things:
|
I'll make sure to do that once I located and fixed a remaining issue in combination with JDT (if I select a method that's within a custom folding region and enter text, it seems to show "too much" text for some reason). While I think that's an issue with JDT-UI (it only seems to happen with custom folding regions and extended folding), I want to be sure about it first (and I opened this PR before everything is finished to make it visible in advance/allow for discussion if applicable). |
bb4f64a to
5274f99
Compare
While ProjectionViewer supports both using visible regions and projections, these features cannot be used in conjunction. This change allows the use of projections when visible regions are used. Fixes eclipse-platform#3074
|
I have made the requested changes. However, I want to note the following:
|
While ProjectionViewer supports both using visible regions and projections, these features cannot be used in conjunction. This change allows the use of projections when visible regions are used. Fixes eclipse-platform#3074
5274f99 to
5b7cb97
Compare
While ProjectionViewer supports both using visible regions and projections, these features cannot be used in conjunction. This change allows the use of projections when visible regions are used. Fixes eclipse-platform#3074
5b7cb97 to
fb861bc
Compare
|
I am not sure why the Jenkins build seems to have issues getting tycho set up (maybe issues with https://repo.eclipse.org/?) |
|
Yes there are infrastructure problems again:
I restarted the build. |
While ProjectionViewer supports both using visible regions and projections, these features cannot be used in conjunction. This change allows the use of projections when visible regions are used. Fixes eclipse-platform#3074
fb861bc to
c5fb5f3
Compare
|
It looks like there was a test failure: https://ci.eclipse.org/platform/job/eclipse.platform.ui/job/PR-3074/lastCompletedBuild/testReport/ |
While ProjectionViewer supports both using visible regions and projections, these features cannot be used in conjunction. This change allows the use of projections when visible regions are used. Fixes eclipse-platform#3074
c5fb5f3 to
f34844d
Compare
While ProjectionViewer supports both using visible regions and projections, these features cannot be used in conjunction. This change allows the use of projections when visible regions are used. Fixes eclipse-platform#3074
f34844d to
7ff50f2
Compare
While ProjectionViewer supports both using visible regions and projections, these features cannot be used in conjunction. This change allows the use of projections when visible regions are used. Fixes eclipse-platform#3074
7ff50f2 to
2ce3ba0
Compare
|
I now switched to an approach that should have fewer side effects. Instead of adding additional projection regions, I am now using the |
While ProjectionViewer supports both using visible regions and projections, these features cannot be used in conjunction. This change allows the use of projections when visible regions are used. Fixes eclipse-platform#3074
d2f4f5a to
7a9cf09
Compare
While ProjectionViewer supports both using visible regions and projections, these features cannot be used in conjunction. This change allows the use of projections when visible regions are used. Fixes eclipse-platform#3074
|
This PR caused regression: #3380 |
|
This PR caused another regression: eclipse-jdt/eclipse.jdt.ui#2532 @mickaelistria, @danthe1st : please follow up. The way the listener is added & removed is not OK, as it will be not always removed. A simple solution is doable, I've posted it on the bug, but I'm not sure if that is enough. |
|
@danthe1st @iloveeclipse I think we should give about a week for a fix to be pushed, and if nothing has happened before that, we can revert. |
|
causes breaking change in Xtext comment editing strategy eclipse-xtext/xtext#3531 |
|
is this feature included in the new Eclipse 2025 12 ? where is it going to be included in a official release ? |
It's merged so I expect it is in the release, which will go live later today. |
|
I can not wait :) Thanks for the replay |
This feature s included in 2025-12 but the JDT one as some issues are still open. See #3456 (my plan was to rebase that and test everything and some point this month/after the release but I didn't get to it) (and technically also #3457 (comment) but I don't consider that to be a big issue). if you really want to try it out, feel free to build JDT-UI from source (if you need help with that, you can contact me directly if you want to). |
|
Just downloaded the new Sts and I tested it it seem to be working Thank You very much :) Why don't they include this feature in the new features I looked for it in the New & Noteworthy page For me it is an important fix which is so useful allow to use both the folding and the show only selected element together at the same time. It really help you to focus on the code you want to work at the a specific method |
It shouldn't do anything if you don't have the JDT-UI patch (or use a different editor making use of that) which isn't merged yet..? This is why there's no N&N about it in 2025-12. This PR is just about giving Eclipse Platform the necessary capabilities for this. Of course, a custom editor may use that functionality. But yes, if you apply the JDT-UI patch yourself and somehow install it into Spring Tools 5 (or Eclipse 2025-12), it should work. |
Oh, I think I understand why it "works" for you. This is just because you enabled the option while the file is opened. The JDT-UI change (which is not merged yet) makes sure that this feature works on newly opened files (basically, it removes some code that disables that feature). Until eclipse-jdt/eclipse.jdt.ui#2302 is merged, you cannot expect this to work. If you close and reopen the file, it shouldn't show any folding regions. If a But for Java-specific things, this (platform-UI) is (probably) not the right repository. Note: I am just an outside contributor, I am not a maintainer of any Eclipse projects. I am just occasionally contributing to Eclipse in my free time (when I consider something to be important or interesting enough). |
|
Should I report the disappearing bracket when invoking show only selected element as bug to Eclipse or Sts Repository ? Also when do you think the patch of JDT-UI patch be merged ? |
If you can reproduce it with Eclipse 2025-12 and eclipse-jdt/eclipse.jdt.ui#2302 (you have to compile JDT-UI yourself), please add a comment in that issue (and hopefully, I can take a look). If it cannot be reproduced like that, I don't think it would be a bug as it isn't enabled anyways. Spring Tools would be the wrong repository.
Whenever it's finished. It depends on my motivation. There's also another issue with it which would be good to resolve first. Creating a new issue for something JDT-UI specific doesn't make sense as the relevant PR isn't merged yet (again, it only affects open editors when you enable the feature in the preferences). |
I just downloaded Eclipse 2015 12 ( not Sts basic Eclipse ide in zip format) from the website. A clean install without your patch (because I dont know how to install it or compile and ide with a patch) and did the same test the folding sort of work with show only selected element and bracket still disappear it seem to be a bug that did happen before should I report it as a bug ? and to which repository ? Before invoking show only selected element on the main method After invoking show only selected element on the main method |
Does it also happen if you close and reopen the editors after setting the preference (without changing the preference again)? Also, it would be useful to know the exact code you are using (with whitespace) and the folding configuration. If not, I wouldn't consider this to be a fully implemented feature. |
The folding is enabled in the preference screen with the default values I did not touch it I tested it again with closing and opening the file and find something interesting the bug (meaning the disappearing on ending bracket bug) does not always happen if I close the editor than reopen it when the show only selected element is on I get all the methods in the file and when I focus on one method using the outline view I get to see only that method with the ending bracket so in this case the bug does not occur It is only when I open a file while the show only selected element is off then I click the icon in the toolbar to invoke it (and nothing changes) and then I click the method I want to focus on the outline view and I see only that method without the ending bracket so in this case the bug occur So it seems that only if you invoke show only selected element on a file is already open and go to a method using the outline view the bug happen and the ending bracket disappear and this is a bug should I report this bug ? and to who ? Edit : One good thing from all of this even with the bug folding now works when you show only selected element is enabled so the changes you merged even without the patch did make a great difference so Thank You for that |
Yes, that is what I am saying the whole time. The unintended behavior (which I don't consider to be a problem) is that the feature works if you enable the preference while editors are open (in fact, restarting the IDE should result in folding being disabled as well until the other PR is merged). When I tried it, I didn't have the situation with the closing
I don't think it makes much sense to create a new issue anywhere. If you have reliably steps to reproduce it, feel free to comment it in the aforementioned PR (I guess just commenting here is fine as well) but by just typing similar code, it didn't seem to do anything for me (maybe it's Windows-specific/only happens with CRLF, I didn't check that situation due to me using Linux - maybe I can check that at some point). |
|
Yes, it's because of Windows line endings. I hope that I can take a look at that. |
|
Thank you for your help I hope you fix it in the future I be waiting but you did make the folding work when show only selected is on so that is a great improvement and I be using that |
|
@totomomo18 #3585 should fix that part. |




This is my attempt to fix #3073 in order to implement eclipse-jdt/eclipse.jdt.ui#2264
Description
ProjectionViewercurrently cannot use visible regions and projections together (except by callingenableProjections()aftersetVisibleRegionsin which case it will show a wrong region). This PR changes the implementation of visible regions to collapse everything outside the visible region.Note
This PR does not allow collapsing or expanding any projection/folding regions outside of the declared visible region (e.g. by other code modifying the document in some way or if a projection region is partially in the visible region).
Aside from that, this implementation has the following effect: If
setVisibleRegionis called with a region that is fully collapsed, the editor is basically empty. If another behavior is desired, it would be good to know what the better behavior is.testing with JDT
To test this with JDT as requested in eclipse-jdt/eclipse.jdt.ui#2264, do the following: