You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: show the hovers of several language servers in the order of their names - #2058
A hover asks each language server of the file, and showed their answers in the order of the list of language servers that LanguageServiceAccessor.getLanguageServers gives for the file. That list is filled as each language server has started and has the file, from chains that run in parallel, so its order changes from one hover to the next, even with both language servers running. So the same hover showed the answers of two language servers in a different order each time, as #390 describes.
The answers now come in the order of the display names of the language servers, regardless of case, then of their ids, as agreed in #390 (LSPHoverSupport).
Not here: the empty first page of #390, the hover of a language server which answers without contents. Since 71f6d73, such a hover gives no documentation target, so it no longer shows as a page.
Test: HoverOrderTest asks for the hover of two language servers while one of them is still starting, which makes it come last in the list: the answer of the one whose name comes first comes first, whichever starts last, and names are compared regardless of case. Without the change, the test where the first-named one starts last and the case test fail on each run, with the answers in the order Zeta, Alpha. It and the documentation and hover tests pass (36 tests).
…r names
A hover asks each language server of the file and shows their answers in
the order in which the language servers were found for the file, which
is the order in which each one was started and had the file: it changes
from one hover to the next, so the same hover showed the answers of two
language servers in a different order each time. The answers now come in
the order of the names of the language servers, regardless of case, then
of their ids.
No actionable comments were generated in the recent review.
Summary
Summary by CodeRabbit
Bug Fixes
Hover information from multiple language servers is now presented in a consistent order, sorted alphabetically by server name without regard to capitalization. When servers have matching names, their results follow a stable secondary order. This replaces the previous ordering, which could vary depending on how servers were discovered.
Hover requests now follow a deterministic order based on case-insensitive language-server display names, with server IDs as a tie-breaker. Tests check the order when server discovery order changes and when names differ only by case.
Changes: Hover ordering
Layer / File(s)
Summary
Sort hover requests and verify result order src/main/java/com/redhat/devtools/lsp4ij/features/documentation/LSPHoverSupport.java, src/test/java/com/redhat/devtools/lsp4ij/features/documentation/HoverOrderTest.java
Eligible language servers are sorted by display name without case sensitivity, then by ID, before hover requests are collected. Tests check result order across reversed discovery sequences and case differences in server names.
Hovers from several language servers now appear in a stable order by server name. No actionable merge-blocking risk was identified.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title states the main change: hovers from several language servers are shown in the order of their names. The raw summary confirms that LSPHoverSupport now sorts eligible servers by case-insensiti…
Description check
The description explains the cause (server order depends on parallel startup), the fix (sort by display name ignoring case, then by ID), the excluded items from #390, and the new HoverOrderTest. It ma…
Linked Issues check
[#390] The directly linked issue asks for a deterministic hover order for several language servers while the same servers run. Alphabetical order by server name is named as one acceptable approach. At…
Out of Scope Changes check
The change set, as summarized for the whole PR against merge base b982bd4, touches LSPHoverSupport.java (the sort comparator and its use before hover requests) and adds HoverOrderTest.java. Both dire…
Full details: Title check
Explanation
The title states the main change: hovers from several language servers are shown in the order of their names. The raw summary confirms that LSPHoverSupport now sorts eligible servers by case-insensitive display name, then by ID, and the test covers that ordering.
Full details: Description check
Explanation
The description explains the cause (server order depends on parallel startup), the fix (sort by display name ignoring case, then by ID), the excluded items from #390, and the new HoverOrderTest. It matches the changeset.
Full details: Linked Issues check
Explanation
[#390] The directly linked issue asks for a deterministic hover order for several language servers while the same servers run. Alphabetical order by server name is named as one acceptable approach. At head, LSPHoverSupport.getHover(...) sorts the language servers with BY_SERVER_NAME (display name, String.CASE_INSENSITIVE_ORDER, then server id) before it creates the hover futures. mergeInOneFuture keeps that list order. The order therefore no longer depends on discovery order. HoverOrderTest holds one server's initialize while the other opens the file. It checks that the server with the first name comes first whichever server starts last, and that name comparison ignores case. The empty first page in #390 is a symptom. The PR excludes it and states that a hover with empty contents gives no documentation target since 71f6d73. That claim was not verified in this review. The ordering requirement, which is the main objective, is met by code at head. The author reports 36 passing tests. Those results were not re-run here.
Full details: Out of Scope Changes check
Explanation
The change set, as summarized for the whole PR against merge base b982bd4, touches LSPHoverSupport.java (the sort comparator and its use before hover requests) and adds HoverOrderTest.java. Both directly serve the #390 ordering objective. No unrelated file or behavior change was identified. The file-level diff tool was unavailable, so the summary of changed files was used. The head contents of LSPHoverSupport.java were read and match the summary.
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 91a1a825-1e3d-46bb-b104-42db99d8c540
Commits
Reviewing files that changed from the base of the PR and between b982bd4 and fecc310.
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.
Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
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
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.
Fixes #390.
A hover asks each language server of the file, and showed their answers in the order of the list of language servers that
LanguageServiceAccessor.getLanguageServersgives for the file. That list is filled as each language server has started and has the file, from chains that run in parallel, so its order changes from one hover to the next, even with both language servers running. So the same hover showed the answers of two language servers in a different order each time, as #390 describes.The answers now come in the order of the display names of the language servers, regardless of case, then of their ids, as agreed in #390 (
LSPHoverSupport).Not here: the empty first page of #390, the hover of a language server which answers without contents. Since 71f6d73, such a hover gives no documentation target, so it no longer shows as a page.
Test:
HoverOrderTestasks for the hover of two language servers while one of them is still starting, which makes it come last in the list: the answer of the one whose name comes first comes first, whichever starts last, and names are compared regardless of case. Without the change, the test where the first-named one starts last and the case test fail on each run, with the answers in the orderZeta, Alpha. It and the documentation and hover tests pass (36 tests).