fix: Send a single hover request every time the user hovers#1544
Merged
rubenporras merged 1 commit intoJun 9, 2026
Conversation
…fferent part of the document I looked at the Eclipse Platform code and the protocol for `getHoverRegion` and `getHoverInfo2` seems to be: ```java IRegion region = hover.getHoverRegion(viewer, offset); // setup some stuff with region hover.getHoverInfo2(viewer, region); ``` So the region returned from `getHoverRegion` is also the one passed back to `getHoverInfo2`. We can use this to return a custom Region object which holds the request sent to the LS. This way, `getHoverInfo2` can simply use that stored request instead of having to do its own bookkeeping to know if the last stored request is the correct one to use. Fixes eclipse-lsp4e#1514
Contributor
Author
|
This is the alternative fix for #1514 that I mentioned in #1533 (comment) @betamaxbandit I incorporated the test cases from your PR which also pass with these changes. I prefer the changes of this PR because it greatly reduces the complexity / state of LSPTextHover |
rubenporras
approved these changes
Jun 9, 2026
rubenporras
left a comment
Contributor
There was a problem hiding this comment.
Hi Florian,
thanks for taking a look. Let us try this approach.
Regards
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
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.
I looked at the Eclipse Platform code and the protocol for
getHoverRegionandgetHoverInfo2seems to be:Most importantly, the region returned from
getHoverRegionis also the one passed back togetHoverInfo2. We can use this to return a custom Region object which holds the request sent to the LS. This way,getHoverInfo2can simply use that stored request instead of having to do its own bookkeeping to know if the last stored request is the correct one to use.This also makes sure that exactly one request is sent per getHoverRegion/getHoverInfo2 cycle.
I also added another fast-path to avoid async loading, if the result is already present.
Fixes #1514