Skip to content
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

Cycle through hover results from multiple LSPs #10122

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

kyfanc
Copy link
Contributor

@kyfanc kyfanc commented Apr 3, 2024

replaces #9744 with improved UX.

inspired by #9974

This PR refactor LSP hover feature with the event system, with support of cycling through hover results from multiple LSPs.

keybinding:

  • Shift+Left for previous hover
  • Shift+Right for next hover

asciicast

@kyfanc
Copy link
Contributor Author

kyfanc commented Apr 4, 2024

Also, seems there are some concurrency issues in the integration test.
It failed after ~6h in the previous action.

And i tried to run cargo integration-test locally in my mac, for both this PR & tag 24.03, both failed unstably.
like 2x out of 82 tests failed. but if I run them individually like cargo integration-test test::movement, the failed tests ran successfully.

Any idea?

@kyfanc kyfanc marked this pull request as draft April 4, 2024 03:08
@kyfanc kyfanc marked this pull request as ready for review April 4, 2024 03:49
@kirawi kirawi added A-language-server Area: Language server client A-helix-term Area: Helix term improvements S-waiting-on-review Status: Awaiting review from a maintainer. labels Apr 4, 2024
@pascalkuthe
Copy link
Member

I have very similar concerns/review as in #9974:

  • you don't need to introduce a handler since this is not really async, the current hover code works fine. Eagerly requesting however from all lsps and then cycling trough them is much much simpler and more efficient. Specifically I refactoring the signature help with the event system because that is something that pops up automatically and hence needs timeouts/denounces. However is only requested by pressing <space>k so all that complex code is not needed
  • keymap should be a-p and a-n to avoid conflicts yet stay consistent with feat: add symbol kind info in picker #9774

@pascalkuthe pascalkuthe added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from a maintainer. labels Apr 14, 2024
@kyfanc kyfanc force-pushed the cycle-multi-lsp-hover branch 2 times, most recently from 65d7105 to 9f9016b Compare April 16, 2024 09:09
@kyfanc
Copy link
Contributor Author

kyfanc commented Apr 16, 2024

Thank for the review and comments.

The new push removed the unnecessary handler codes, and updated the keymap as suggested.

@pascalkuthe pascalkuthe added S-waiting-on-review Status: Awaiting review from a maintainer. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 16, 2024
@cotneit
Copy link
Contributor

cotneit commented Aug 26, 2024

This seems to be working great! Merge with master was pretty straightforward, just a few suggestions:

  • I think it would be better to not display LS name if only one LS returned a result
  • Bottom padding seems excessive, I think 1 line instead of 2 would be a better fit

For visual reference:
master
image
this PR
image

@kyfanc
Copy link
Contributor Author

kyfanc commented Aug 27, 2024

Thanks for the suggestions.
I have rebased onto master with some conflict resolved, and improved the UI as suggested.
This is how it looks like now.

Single result

Screenshot 2024-08-27 at 7 38 54 PM

Multiple results

Screenshot 2024-08-27 at 7 39 41 PM

@paulvandermeijs
Copy link

Great work!

I've been exploring the use of a language server to show git blame information on hover, which was pretty much useless without this. Only issue I noticed during development of the language server is that when the language server is slow or times out it will block messages from other language servers.

@kyfanc
Copy link
Contributor Author

kyfanc commented Oct 18, 2024

Thanks for your comment! The Git LSP sounds like interesting idea.

Regarding the blocking behaviour, it might be a bit complicated to manage UI interaction with the async responses from each LSPs. I am thinking about if it should display hovers preserving the order of LSPs in config, or by the response sequence from LSPs. It might better to be a separate PR as improvement.

I have rebased onto master with some conflict resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements A-language-server Area: Language server client S-waiting-on-review Status: Awaiting review from a maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants