Add anchor preview in hover
What does this PR do?
It displays the preview of an anchor when hovering it.
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.
coverage: 82.913% (-1.0%) from 83.961% when pulling 235ca9f98ee99c7a5bfa2e7c39626de49d152a1c on Hugo-Hache:hh/hover-anchor into d17039f1fc1880a3edce45589988822608f3b44d on redhat-developer:main.
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.
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.
- 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)