-
Notifications
You must be signed in to change notification settings - Fork 50
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
Response timeout when description requested on a keyword #128
Comments
Hmm, this sounds like a nimsuggest issue. I guess the way forward would be to test with just nimsuggest and see if that has the same issue. |
Not sure if nimsuggest is to be blamed. # This is just an example to get you started. A typical hybrid package
# uses this file as the main entry point of the application.
import playgroundpkg/submodule
when isMainModule:
echo(submodule.getWelcomeMessage()) with then invoking
Reply of nimsuggest to definition of a keyword or module-identifer token with |
Thanks for the reproduction sample, I think I found the issue. Due to a recent refactor the code path to send the reply was only inside the block where it had definitions. I think this should be fixed in cf07e22, could you check it out? |
Thank you! It seems issue with Unfortunately the issue still persists for Any chance for a similar quick fix? |
Do you know which LSP commands are called by those two? If so I can fix it easily |
Not sure about that, I'm not an elisp guy. From the source of that function, it seems like `"textDocument/hover" command and "hover-contents"(?) are invoked: (defun lsp-describe-thing-at-point ()
"Display the type signature and documentation of the thing at
point."
(interactive)
(let ((contents (-some->> (lsp--text-document-position-params)
(lsp--make-request "textDocument/hover")
(lsp--send-request)
(lsp:hover-contents))))
(if (and contents (not (equal contents "")))
(let ((lsp-help-buf-name "*lsp-help*"))
(with-current-buffer (get-buffer-create lsp-help-buf-name)
(with-help-window lsp-help-buf-name
(insert (string-trim-right (lsp--render-on-hover-content contents t))))))
(lsp--info "No content at point.")))) from lsp-protocol.el (Hover (:contents) (:range))
(HoverParams (:textDocument :position) (:uri)) Not sure how the latter is exactly translated to a LSP request. When no definition can be retrieved, an empty/nil response is to be expected, which would lead in |
The issue still persists, however I did solved it by replacing with alternate server: nimlangserver, which does not suffer described behavior. It may be related to a different approach how Leaving it as a notice here for possible other affected users, just for the sake of reference. |
I've noticed hover being a bit broken myself lately. It seems like something in the library version of nimsuggest is causing issues and I'm looking into it. |
It probably goes to https://github.com/nim-lang/Nim/blob/d372ad3ee6563cff2c086e774f1e00b091b79373/compiler/suggest.nim#L502 I've debugged into this , replace it with |
problem description
When in Nim's source code contextual help is invoked on a keyword like
when
,return
,proc
etc, nimlsp/nimsuggest stops responding until editor's timeout expires (12 seconds in my case).logged information of the event
lsp-request: Timeout while waiting for response. Method: textDocument/hover
testing environment
emacs 28.1, lsp-mode-20220605, nimlsp v0.4.1, nim 1.6.6, OS Linux x86_64
expected behavior
Reply immediately either with a appropriate description or info about there is no description available.
When the contextual help is invoked on other tokens like variables, types, literals, procedures - nimlsp responds instantly with a correct description.
The text was updated successfully, but these errors were encountered: