emacs-lsp / lsp-ui

UI integrations for lsp-mode
https://emacs-lsp.github.io/lsp-ui
GNU General Public License v3.0
1.03k stars 141 forks source link

`lsp-ui-doc-glance` auto-hide is not triggering #695

Closed Lenbok closed 1 year ago

Lenbok commented 2 years ago

The documentation for this function says that the documentation will automatically hide on next typing, however this does not happen, in my experience.

Perhaps my reading of the code is wrong, but it seems the mechanism for clearing is unreliable, in that the clearing of the doc is triggered via post-command-hook but the retrieval of the documentation from the language server happens asynchronously (i.e. it's quite likely that the documentation is returned after lsp-ui-doc--glance-hide-frame has been removed from post-command-hook, which would lead to the documentation persisting).

I also put a message at the start of lsp-ui-doc--glance-hide-frame and it seems to be called immediately, rather than after the next command. Does adding a function to post-command-hook while a command is currently executing result in that function being called when the current command finishes executing? If so, this also seems like the wrong behaviour.

It seems that the addition of lsp-ui-doc--glance-hide-frame to post-command-hook should instead happen once the documentation is returned from the server.

Edit: the bug only affects inline doc display mode.

jcs090218 commented 2 years ago

I agree with you. Even though I rarely see the issue from the current implementation! 😅

Thanks for the changes!

jcs090218 commented 2 years ago

I think this broke lsp-ui-doc-show command (report in #709). I have reverted #696 with #710 for now.

Let me reopen this issue.