Open thomasheartman opened 1 year ago
Can you double check you are actually using lsp-ui version https://github.com/emacs-lsp/lsp-ui/commit/a94bcec2071ee196bc83e52ad92ec0881f8bcfbd or higher? Prior to that version I would expect the delay you are seeing, but that commit fixed the issue, and indeed it works correctly for me.
Thanks for the response 😄 As far as I can tell, I am indeed using version 494bcec or higher. At least M-x find-library lsp-ui
takes me to a straight repo currently on version 8d4fa5a14f5b5c6f57bc69f454eba6861ed2ba9f. I closed and reopened emacs to make sure I didn't have an older version lying around, but no dice, I'm afraid. Would you like me to double check in some other way?
Perhaps put a similar message inside the let
s in both lsp-ui-doc-glance
and lsp-ui-doc-show
to trace a little more. Does directly calling lsp-ui-doc-show
also exhibit the delay before the doc appears?
Sure thing! And yeah, calling lsp-ui-doc-show
directly gives the same delay.
Here's some 'log' output. For glance
and show
, the log message is within their let blocks, before calling their final function. For the make-request
function, I added three different log lines:
lsp-ui-doc--hide-frame
and setting the timerlsp-ui-doc-glance | lsp-ui-doc-delay: 2
lsp-ui-doc-show | lsp-ui-doc-delay: 0
lsp-ui-doc--make-request (top) | lsp-ui-doc-delay: 0
lsp-ui-doc--make-request (middle) | lsp-ui-doc-delay: 0
lsp-ui-doc--make-request (top) | lsp-ui-doc-delay: 2
lsp-ui-doc--make-request (middle) | lsp-ui-doc-delay: 2
lsp-ui-doc--make-request (top) | lsp-ui-doc-delay: 2
lsp-ui-doc--make-request (lambda) | lsp-ui-doc-delay: 2
Interestingly, it seems as if lsp-ui-doc--make-request
is called multiple times with different doc delay values.
lsp-ui-doc-show | lsp-ui-doc-delay: 0
lsp-ui-doc--make-request (top) | lsp-ui-doc-delay: 0
lsp-ui-doc--make-request (middle) | lsp-ui-doc-delay: 0
lsp-ui-doc--make-request (top) | lsp-ui-doc-delay: 2
lsp-ui-doc--make-request (middle) | lsp-ui-doc-delay: 2
lsp-ui-doc--make-request (lambda) | lsp-ui-doc-delay: 2
This seems to work the exact same as with glance
, except it doesn't have the initial glance
call.
From what I can make out, there is something that happens after the first request has started, which invokes make-request
again with a different timeout. Presumably this also resets the popup, so it doesn't show. Does this sound familiar at all?
The trace suggests that the show/glance popup is getting dismissed immediately and then you are seeing a popup initiated via lsp-ui-doc-mode
cursor hover (since that also triggers calls to lsp-ui-doc--make-request
, but without overriding the delay). Are you using lsp-ui-doc-show-with-cursor
? Try turning it and/or lsp-ui-doc-mode
off.
Ah, okay, that might explain it indeed. And yeah, I am using lsp-ui-doc-show-with-cursor
. Turning that off fixes the removes the delay when called directly. Thanks!
I realize I wasn't completely clear about this in my opening post, so sorry for the confusion. A bit late, but here's my use case / what I want to achieve:
lsp-ui-doc-delay
), the doc should pop upshow
or glance
, then the doc should pop up immediately.In other words, I'd like to leave lsp-ui-doc-show-with-cursor
on, so that the doc pops up automatically after a timeout. At the same time, I'd like to be able to invoke it explicitly and have it show up immediately.
Is that possible at the moment or is that not supported?
Description and expectations
The variable
lsp-ui-doc-delay
controls how long you need to idle before the lsp-ui-doc popup shows up. However, it also seems to affect how long it takes before the doc pops up when you explicitly trigger the doc, which is unexpected.So for instance, if I run
lsp-ui-doc-glance
in a buffer, it'll only show afterlsp-ui-doc-delay
seconds. This seems like strange behavior. I would expect that when you manually trigger it, it'd show immediately.Additional info
I did some digging, and I found this defun which is used by both
lsp-ui-doc-glance
andlsp-ui-doc-show
. It should (as far as I can tell), setlsp-ui-doc-delay
to0
for thelsp-ui-doc--make-request
function.I'm not very experienced at debugging elisp, but I put a
message
call within thelsp-ui-doc--make-request
function and evaluated the defun. Whenever I invoked thelsp-ui-doc-glance
function, it would tell me thatlsp-ui-doc-delay
was whatever it was usually set to (and definitely not0
). So for some reason, it seems that this variable doesn't apply correctly.Do you know what's going on here? I'd be happy to share any other details if you need anything. Thank you!
System details