Skip to content

Conversation

@Hugo-Hache
Copy link

@Hugo-Hache Hugo-Hache commented Dec 5, 2025

What does this PR do?

It displays the preview of an anchor when hovering it.

image

What issues does this PR fix or reference?

This is a very rough proposal to check if you would be interested in merging this feature. If this is the case, I'll put more time in writing the test and improving the code based on your remarks.

@coveralls
Copy link

coveralls commented Dec 5, 2025

Coverage Status

coverage: 82.913% (-1.0%) from 83.961%
when pulling 235ca9f on Hugo-Hache:hh/hover-anchor
into d17039f on redhat-developer:main.

@datho7561 datho7561 self-requested a review December 5, 2025 21:50
@datho7561
Copy link
Contributor

I think this sounds helpful. I can find time to review it, though I can't promise I'll be fast.

I tried it out, and I have a good initial impression of it. I haven't tested it thoroughly or looked closely at the code yet though.

I noticed it was disabled by default, any reason for that? It seems like a helpful feature, and I can't think of drawbacks of enabling it by default. People need to go out of their way to find any features that aren't enabled by default, which could mean it doesn't get used.

@Hugo-Hache
Copy link
Author

As I didn't know if it was a common use case I conservatively set the default to false, but I agree with you that plenty of users might discover this hover by serendipity and enjoy it.

For the resolveYamlMapMergeKeys function I guess we would need to limit the number of recursion to prevent performance issue in very large YAML (but I noticed there is a maxItemsComputed, so maybe it's enough to prevent it).

Anyway it's good news it looks helpful to you. Thanks for the time you'll invest in testing/reviewing it.

Copy link
Contributor

@datho7561 datho7561 left a comment

Choose a reason for hiding this comment

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

I think this looks pretty good, but for performance reasons I think there should be some limit to prevent infinite recursion (the maxItemsComputed doesn't seem to stop it from computing when there's infinite recursion, so the hover never shows up and it seems to continue computing the result in the background).

Also, I really think this should be enabled by default.

@Hugo-Hache
Copy link
Author

Hugo-Hache commented Dec 10, 2025

  • Changed shouldHoverAnchor to default as true
  • Added MAX_MERGE_RECURSION_LEVEL (and simplified code by removing resolveYamlMapMergeKeys or seenKeys)

I committed a max recursion level of 10, does it look good to you? (screenshot with a modified local limit of 3)

Screenshot 2025-12-10 at 18 05 39

@datho7561 datho7561 moved this to In Progress in Java Tooling Dec 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

3 participants