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

Use CursorHold for LSP hover messages #1532

Closed
w0rp opened this issue Apr 26, 2018 · 8 comments
Closed

Use CursorHold for LSP hover messages #1532

w0rp opened this issue Apr 26, 2018 · 8 comments
Labels
enhancement LSP Any issue relating to LSP or tsserver

Comments

@w0rp
Copy link
Member

w0rp commented Apr 26, 2018

ALE now supports an :ALEHover command for displaying information at the cursor, but we can take this to the next level with the following changes.

  1. Re-use the truncated echo function from ale#cursor to implement a truncated echo message to avoid interrupting editing.
  2. Add support for calling the hover function so it will use the truncated echo.
  3. Add support for setting CursorHold to trigger the truncated echo version of :ALEHover, using the first line of output.
  4. Avoid replacing the messages about diagnostics ALE echoes, so problems take priority over basic information. (Detect if the feature is turned on.)

With the series of changes described above, it should be possible to create a version of hover messages where messages display when you move your cursor over things and actually "hover."

@w0rp w0rp added enhancement LSP Any issue relating to LSP or tsserver labels Apr 26, 2018
@w0rp w0rp added this to the Version 2.0 milestone Apr 26, 2018
@w0rp w0rp changed the title User CursorHold for LSP hover messages Use CursorHold for LSP hover messages Apr 26, 2018
@af
Copy link
Contributor

af commented Apr 26, 2018

A longer-term feature that would be super cool: support neovim's floating windows (if/when they're merged), to show the hover messages right above the cursor!

@andreypopp
Copy link
Contributor

Avoid replacing the messages about diagnostics ALE echoes, so problems take priority over basic information. (Detect if the feature is turned on.)

That’s not always desirable as one can use :ALEHover to fix the problem — the workflow I have when working with Merlin/OCaml — I go to the line with an error and query for types under the cursor to get the proper understanding of the problem.

@w0rp
Copy link
Member Author

w0rp commented Apr 26, 2018

If you want to see the message, you can type :ALEHover anyway. This would be in addition to that.

@andreypopp
Copy link
Contributor

If you want to see the message, you can type :ALEHover anyway. This would be in addition to that.

Ok, I mistakenly thought this applies to :ALEHover too. It makes sense to me then, sorry for the noise.

@w0rp w0rp removed this from the Version 2.0 milestone May 16, 2018
@mlwarner
Copy link

mlwarner commented Aug 8, 2018

I have a naive version of this at https://github.com/mlwarner/ale/commit/ecbf3a124656687f0950a03a5e6930327418868b but probably can't get to it until this weekend. Still needs

  1. To not override the diagnostic CursorHold
  2. Unit tests + refactoring to move the truncated message out of the cursor

otherwise it meets the first 3 points required

@jandudulski
Copy link

A longer-term feature that would be super cool: support neovim's floating windows (if/when they're merged), to show the hover messages right above the cursor!

it seems that this feature has been released 🎉

@wizardlink
Copy link

Will this ever be implemented? I have been looking to have similar behavior from Shougo/echodoc, and I saw that :ALEHover had that already, but only manually.

@w0rp
Copy link
Member Author

w0rp commented Aug 4, 2020

I have implemented this now at last. I tested it during my day job, and the messages are subtle enough that I turned the new g:ale_hover_cursor setting on by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement LSP Any issue relating to LSP or tsserver
Projects
None yet
Development

No branches or pull requests

6 participants