-
-
Notifications
You must be signed in to change notification settings - Fork 895
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
rust: no details in completion popup #4591
Comments
Thanks for reporting this issue. Is this the expected behavior from the upstream (language server)? 🤔 |
rust-analyzer developers say in rust-lang/rust-analyzer#18351 (comment)
This was added by rust-lang/rust-analyzer#18167 Recommendation sounds very expensive to me (but I do not have any idea about the LSP protocol) and disabling lazy-resolve support sounds better. |
Can you try to move to the next item in the completion list to see if the function detail will be displayed for the previously selected item? |
does not have an effect; details are not shown I do not see any lsp communication in the
Does this really result in better performance? For me, this sounds very expensive. E.g. instead of parsing a "detail" (and perhaps "documentation") attribute in hundreds/thousands of completion candidates, you have to send hundreds/thousands resolve requests, wait for their responses and parse them. |
The point is server can opt-in into this if it makes sense for them. You can see, fetching documentation and details of hundreds/thousands of candidates can be very expensive as it hit disk to get the documentation. Moreover, that fetching happens on every single keystroke that most likely the user doesn't care about. Also, that make processing every keystroke become slower. When lazy-resolving is supported, that means there's no waste to retrieve more information (and potentially disk reading) when the user is typing. Now, after the user has finish typing and starts looking at the candidates, we can start fetching candidates' detail when the user is interacting with normally a smaller number of candidates instead of all candidates. And they should be quicker than fetching the whole data at the beginning so the user would feel LSP run faster as well. |
Sounds like a design flaw of the LSP protocol... Clients should be able to set this per request. E.g. minimal set of information for the per-keystroke action and detailed set for the dropdown list with completions.
I do not see this here:
For my use case I do not see a big reduction of candidates. E.g. often when I look in the completion dropdown list, I have only a raw idea about the method (naming, return type) and have to browse large parts of the list to find the correct one. I am ok with fetching "documentation" lazily (large amount of text which should be displayed only for a selected item); but "detail" is an essential information which should be made available in the dropdown list immediately. |
Even in that case, you will have more time to look at each candidate than having to fetch everything at first. Btw, I've tried with the nightly build of Windows and it seems that the detail is still fetched and not lazy-resolved. |
this seems to make lazy-resolving yet more slower... Hundreds of resolve requests to fill the completion dialog might be no network issue when sent locally. But over TRAMP? What would be the effects when "detail" is removed from "resolveSupport"? Would this attribute be missing from the resolve answer? Or would it just reenable the field in the
At least with rust, the "detail" property is so small compared with the rest of the response, that the difference is probably not noticable.
strange; here it is
and I tested it with |
I think the push for RA to use lazy-resolving is because the language server can be on remote instead of local, at least that's what pointed out in the discussion. Also, the idle delay is controlled by the completion framework (
It's indeed very strange. I'm not sure why. |
It was thought that PR #4610 might solve this, but in testing with rust-analyzer at commit rust-lang/rust-analyzer@fc98e06 along with lsp-mode |
I don't believe #4610 is an incomplete fix for 2 reasons:
This is indeed what #4610 tries to solve. The issue with company eagerly resolving the entire completion list is a little problematic, perhaps it should follow what #4625 and corfu-pixel-perfect has done, i.e. follow the VS Code model. CC @dgutov |
BTW I can't reproduce this issue on |
Probably this revert... ...would have made this unreproducible in r-a 1.83.0. |
With lsp-mode 20241202.334 + rust-analyzer 1.85.0-nightly (9c707a8 2024-12-07) I still see the effect from the initial report (no details in popup). Details appear after selecting another item in the list (which was added by #4610); while this is a huge improvement, I am still not used at it and miss the old behavior where details are visible immediately. |
@SomeoneToIgnore after our nice little discussion last night, is there a plan to roll back all remnants of rust-lang/rust#133476 ? |
@ensc BTW, are you using company or corfu? |
A more concrete proposal might help. Offhand, I can say that company doesn't resolve the entire completion list - only the entries currently visible in the popup, as well as some annotations (for entries that are string-equal to each other). And the details of that really depend on the implementation in lsp-mode. But if a handful of "resolve" operations can be expensive, then I suppose that could still be suboptimal. |
Sorry I mean #4625 , I've tagged you over there, let's move our convo there. |
company |
Comfirmed this is still happening with rust-analyzer nightly. This is likely a bug in R-A, as suggested here. There's no reason R-A should skip the detail in the response of |
Thank you for the bug report
lsp-mode
related packages.M-x lsp-start-plain
Bug description
With recent "rust-analyzer" versions, completion does not contain details anymore. E.g. with rust-analyzer 1.83.0- nightly (eb4e234 2024-10-09) and later I get
Previous versions (e.g. rust-analyzer 1.83.0-nightly (55a22d2 2024-10-06)) showed
Looking in the io log shows that "detail" and "documentation" attributes are missing with recent rust-analyzer.
See rust-lang/rust-analyzer#18351 too.
Steps to reproduce
Try to complete in rust sources.
Expected behavior
full function signature should be shown in the popup
Which Language Server did you use?
rust-analyzer
OS
Linux
Error callstack
No response
Anything else?
Removing "documentation" + "detail" from
lsp-mode/lsp-mode.el
Lines 3761 to 3762 in 27d6e79
The text was updated successfully, but these errors were encountered: