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

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

Closed
Lenbok opened this issue Apr 6, 2022 · 2 comments · Fixed by #696 or #711
Closed

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

Lenbok opened this issue Apr 6, 2022 · 2 comments · Fixed by #696 or #711
Labels

Comments

@Lenbok
Copy link
Contributor

Lenbok commented Apr 6, 2022

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.

Lenbok added a commit to Lenbok/lsp-ui that referenced this issue Apr 6, 2022
Lenbok added a commit to Lenbok/lsp-ui that referenced this issue Apr 6, 2022
Lenbok added a commit to Lenbok/lsp-ui that referenced this issue Apr 12, 2022
@jcs090218
Copy link
Member

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

Thanks for the changes!

@jcs090218
Copy link
Member

jcs090218 commented May 14, 2022

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.

@jcs090218 jcs090218 reopened this May 14, 2022
Lenbok added a commit to Lenbok/lsp-ui that referenced this issue May 15, 2022
Fixes emacs-lsp#695

For some inexplicable reason, `lsp-ui-doc-show` calls
`lsp-ui-doc--callback` synchronously, while `lsp-ui-doc-glance` went via
a more tortuous asynchronous route (via `lsp-ui-doc--make-request`).

This commit makes `lsp-ui-doc-glance` equivalent to calling
`lsp-ui-doc-show` followed by *delayed* addition to `post-command-hook`
(since we're already in a command) of the
`lsp-ui-doc--glance-hide-frame` function.

Note that `lsp-ui-doc--glance-hide-frame` is also simplified to just
remove itself from `post-command-hook` and directly call
`lsp-ui-doc-hide`.
Lenbok added a commit to Lenbok/lsp-ui that referenced this issue May 15, 2022
Lenbok added a commit to Lenbok/lsp-ui that referenced this issue May 15, 2022
Lenbok added a commit to Lenbok/lsp-ui that referenced this issue May 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants