Rust-analyzer auto-cancels documentation lookups on hover, but only for some functions


How should I go about troubleshooting rust-analyzer's documentation loading?

Some hints get stuck saying Loading..., not randomly, they're always the same in a given file, eg: len() on a vec.
The crate compiles without errors.
There's nothing the in Client output except the usual DEBUG outs after "Using server binary"
On the server trace I'm getting:

[Trace - 4:45:52 PM] Sending request 'textDocument/hover - (33)'.
Params: {
    "textDocument": {
        "uri": "file:///"
    "position": {
        "line": xyz,
        "character": xyz

[Trace - 4:45:53 PM] Sending notification '$/cancelRequest'.
Params: {
    "id": 33

[Trace - 4:45:53 PM] Received response 'textDocument/hover - (33)' in 735ms. Request failed: canceled by client (-32800).
[Trace - 4:45:53 PM] Sending request 'textDocument/hover - (34)'.

I'm not moving my mouse.
Reloading the window doesn't help.


Heh, don't have a lot to add to what you've already done!

[Trace - 4:45:53 PM] Sending notification '$/cancelRequest'.

This sounds like it is the client who cancels the request, I wonder why is that? Looking at in 735ms it might be due to some timeout? I wouldn't expect the think to take that long probably. In terms of debugging this, I'd probably try one of the two things:

  • adding some prints here to make sure that we indeed compute the hover correctly, and not, eg, get stuck in some infinite loop somewhere
  • debug the client to learn why it sends those cancelRequests (no idea how to do that, I was never very succestfull at debugging the issues from the client side).
1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.