Skip to content

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

danthe1st
Copy link

@danthe1st danthe1st commented Jun 29, 2025

This is my attempt to fix #3073 in order to implement eclipse-jdt/eclipse.jdt.ui#2264

Description

ProjectionViewer currently cannot use visible regions and projections together (except by calling enableProjections() after setVisibleRegions in which case it will show a wrong region). This PR changes the implementation of visible regions to collapse everything outside the visible region.

Note

I also didn't test it (much) with regions overlapping with the bounds of the visible region.

If needed, I can change it to try to make sure that parts outside of the visible regions cannot be expanded.

testing with JDT

To test this with JDT as requested in eclipse-jdt/eclipse.jdt.ui#2264, do the following:

  • Create a workspace with eclipse.platform.ui and JDT-UI set up (I did so by creating a Target Platform and added whatever I thought was necessary until I no longer got any errors but I have no idea how to properly do that)
  • Use the changes in eclipse.platform.ui
  • Apply enable folding with "Only show selected Java element" eclipse-jdt/eclipse.jdt.ui#2302 with JDT-UI:
  • Create an "Eclipse Application" run configuration with this version of Eclipse Platform and the patched version of JDT-UI and start it
  • Enable Window > Preferences > Java > Editor > "Only show the selected Java Element"
  • Make sure folding is enabled at Window > Preferences > Java > Editor > Folding
  • Open a Java class
  • Select elements in the outline and observe that only the "selected element" is shown in the editor and folding still works (whether it's normal folding, custom folding regions, "Extended Folding", etc shouldn't make a difference)
    image

Is there a way to launch an Eclipse installation like that from the command line? If yes, @totomomo18 might want to test it.

Note

Expanding a folding region outside the currently visible region will make that folding region visible.

To Do

  • Ensure that the visible region still works when typing (pretty sure that's a JDT issue but I want to be sure)
    • There's still a minor issue with that if you enter text right after the closing } of the currenly selected region.
  • Still hide parts outside of visible region when using "Expand all"
    • integration test

Copy link
Contributor

github-actions bot commented Jul 3, 2025

Test Results

 2 778 files  ± 0   2 778 suites  ±0   1h 38m 37s ⏱️ - 10m 22s
 7 942 tests +11   7 712 ✅ + 9  228 💤 ±0  2 ❌ +2 
23 381 runs  +33  22 633 ✅ +31  746 💤 ±0  2 ❌ +2 

For more details on these failures, see this check.

Results for commit c5c2977. ± Comparison against base commit cee4631.

♻️ This comment has been updated with latest results.

@iloveeclipse
Copy link
Member

@danthe1st : thanks for PR, few things:

  1. Please rebase on master
  2. Please squash two commits into one
  3. Please update commit message to follow commit message guidelines: https://github.com/eclipse-platform/.github/blob/main/CONTRIBUTING.md#commit-message-recommendations

@danthe1st
Copy link
Author

danthe1st commented Jul 3, 2025

@danthe1st : thanks for PR, few things:

1. Please rebase on master

2. Please squash two commits into one

3. Please update commit message to follow commit message guidelines: https://github.com/eclipse-platform/.github/blob/main/CONTRIBUTING.md#commit-message-recommendations

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).

@danthe1st danthe1st force-pushed the projections-with-visible-regions branch from bb4f64a to 5274f99 Compare July 5, 2025 12:48
danthe1st added a commit to danthe1st/eclipse.platform.ui that referenced this pull request Jul 5, 2025
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
@danthe1st
Copy link
Author

danthe1st commented Jul 5, 2025

I have made the requested changes. However, I want to note the following:

  • This has an impact on behavior(al compatibility). If some project/plugin/whatever calls enableProjections() and setVisibleRegion on some ProjectionViewer, this PR affects what is shown to the user.
  • I didn't do performance testing.
  • I think it would be a good idea for someone from JDT (or other projects if make use of this?) to test it before this is merged.

danthe1st added a commit to danthe1st/eclipse.platform.ui that referenced this pull request Jul 5, 2025
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
@danthe1st danthe1st force-pushed the projections-with-visible-regions branch from 5274f99 to 5b7cb97 Compare July 5, 2025 14:40
danthe1st added a commit to danthe1st/eclipse.platform.ui that referenced this pull request Jul 5, 2025
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
@danthe1st danthe1st force-pushed the projections-with-visible-regions branch from 5b7cb97 to fb861bc Compare July 5, 2025 14:59
@danthe1st
Copy link
Author

danthe1st commented Jul 5, 2025

I am not sure why the Jenkins build seems to have issues getting tycho set up (maybe issues with https://repo.eclipse.org/?)

@merks
Copy link
Contributor

merks commented Jul 5, 2025

Yes there are infrastructure problems again:

I restarted the build.

danthe1st added a commit to danthe1st/eclipse.platform.ui that referenced this pull request Jul 5, 2025
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
@danthe1st danthe1st force-pushed the projections-with-visible-regions branch from fb861bc to c5fb5f3 Compare July 5, 2025 17:24
@merks
Copy link
Contributor

merks commented Jul 5, 2025

It looks like there was a test failure:

https://ci.eclipse.org/platform/job/eclipse.platform.ui/job/PR-3074/lastCompletedBuild/testReport/

danthe1st added a commit to danthe1st/eclipse.platform.ui that referenced this pull request Jul 5, 2025
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
@danthe1st danthe1st force-pushed the projections-with-visible-regions branch from c5fb5f3 to f34844d Compare July 5, 2025 18:28
danthe1st added a commit to danthe1st/eclipse.platform.ui that referenced this pull request Jul 5, 2025
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
@danthe1st danthe1st force-pushed the projections-with-visible-regions branch from f34844d to 7ff50f2 Compare July 5, 2025 19:00
danthe1st added a commit to danthe1st/eclipse.platform.ui that referenced this pull request Jul 6, 2025
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
@danthe1st danthe1st force-pushed the projections-with-visible-regions branch from 7ff50f2 to 2ce3ba0 Compare July 6, 2025 08:06
@danthe1st
Copy link
Author

I now switched to an approach that should have fewer side effects. Instead of adding additional projection regions, I am now using the expand() and collapse() methods directly.

danthe1st added a commit to danthe1st/eclipse.platform.ui that referenced this pull request Jul 6, 2025
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
@danthe1st danthe1st force-pushed the projections-with-visible-regions branch 2 times, most recently from d2f4f5a to 7a9cf09 Compare July 6, 2025 10:51
danthe1st added a commit to danthe1st/eclipse.platform.ui that referenced this pull request Jul 6, 2025
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
@danthe1st
Copy link
Author

danthe1st commented Jul 16, 2025

I’m not sure whom to suggest

Yeah I have no idea either and I don't want to randomly start ping people out of nowhere (so I tried to ask people who already commented i.e. you). One option might be to look for people who contributed in that area at some point (doesn't really seem like this is the case for some more than for others?) or I could ask in the platform-dev mailing list.

@iloveeclipse
Copy link
Member

I now switched to an approach that should have fewer side effects. Instead of adding additional projection regions, I am now using the expand() and collapse() methods directly.

Could you please update PR description to match proposed implementation?

danthe1st added a commit to danthe1st/eclipse.platform.ui that referenced this pull request Jul 16, 2025
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
@danthe1st danthe1st force-pushed the projections-with-visible-regions branch from 5a493ee to 2f3a4b7 Compare July 16, 2025 20:10
danthe1st added a commit to danthe1st/eclipse.platform.ui that referenced this pull request Jul 16, 2025
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
@danthe1st danthe1st force-pushed the projections-with-visible-regions branch from 2f3a4b7 to 1756109 Compare July 16, 2025 20:18
danthe1st added a commit to danthe1st/eclipse.platform.ui that referenced this pull request Jul 16, 2025
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
@danthe1st danthe1st force-pushed the projections-with-visible-regions branch from 1756109 to a783bc4 Compare July 16, 2025 20:25
@danthe1st
Copy link
Author

Thank you for your review. I made the requested changes and updated the description.

danthe1st added a commit to danthe1st/eclipse.platform.ui that referenced this pull request Jul 17, 2025
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
@danthe1st danthe1st force-pushed the projections-with-visible-regions branch from a783bc4 to 4327dc9 Compare July 17, 2025 14:40
danthe1st added a commit to danthe1st/eclipse.platform.ui that referenced this pull request Jul 17, 2025
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
@danthe1st danthe1st force-pushed the projections-with-visible-regions branch from 4327dc9 to bdd39d0 Compare July 17, 2025 15:02
@iloveeclipse
Copy link
Member

Just a hint: for all the comments you have resolved, please use "Resolve Conversation" button so it is easier to see what is left open.

danthe1st added a commit to danthe1st/eclipse.platform.ui that referenced this pull request Jul 17, 2025
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
@danthe1st danthe1st force-pushed the projections-with-visible-regions branch from bdd39d0 to c5c5500 Compare July 17, 2025 15:09
danthe1st added a commit to danthe1st/eclipse.platform.ui that referenced this pull request Jul 17, 2025
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
@danthe1st danthe1st force-pushed the projections-with-visible-regions branch from c5c5500 to c5c2977 Compare July 17, 2025 16:11
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
@danthe1st danthe1st force-pushed the projections-with-visible-regions branch from c5c2977 to da38e3d Compare July 22, 2025 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow external visible regions in ProjectionViewer
3 participants