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

Autocomplete suggestions failing in examples #17245

Open
jprochazk opened this issue May 16, 2024 · 2 comments
Open

Autocomplete suggestions failing in examples #17245

jprochazk opened this issue May 16, 2024 · 2 comments
Labels
C-bug Category: bug

Comments

@jprochazk
Copy link
Contributor

jprochazk commented May 16, 2024

rust-analyzer version: rust-analyzer version: 0.3.1958-standalone

rustc version: rustc 1.78.0 (9b00956e5 2024-04-29)

editor or extension: VSCode, rust-analyzer v0.3.1958

relevant settings: -

repository link: https://github.com/jprochazk/tvm/tree/ra-repro

code snippet to reproduce:

This unfortunately does not repro in a fresh project, and I haven't been able to reduce it any further.

The relevant code snippet is:

fn main() {
    use std::time::Instant;

    Instant
    //     ^
    //     type `::` here
}

The relevant files are:

Both files contain the same snippet. I would expect r-a to immediately display code suggestions, including e.g. Instant::now, but in the case of examples/test.rs, it does not show anything. Typing :: as suggested and forcing suggestions via ctrl+space displays a "Loading..." tooltip, and according to the rust analyzer server trace, the request seems to hang:

(I waited 5 seconds here then cancelled it)

[Trace - 11:18:10 AM] Sending request 'textDocument/completion - (750)'.
Params: {
    "textDocument": {
        "uri": "file:///home/jp/dev/tvm/examples/test.rs"
    },
    "position": {
        "line": 3,
        "character": 13
    },
    "context": {
        "triggerKind": 1
    }
}


[Trace - 11:18:15 AM] Sending notification '$/cancelRequest'.
Params: {
    "id": 750
}


[Trace - 11:18:15 AM] Received response 'textDocument/completion - (750)' in 4811ms. Request failed: canceled by client (-32800).

The following sequence of actions also seems relevant:

  1. type :: - nothing
  2. ctrl+space - infinite Loading... appears
  3. escape - request is cancelled
  4. type n - some suggestions appear
  5. delete ::n, and save the file
  6. type ::now - no suggestions at any point
@jprochazk jprochazk added the C-bug Category: bug label May 16, 2024
@kilpkonn
Copy link
Contributor

Do you have term search enabled?
Might be fixed by #17203

@jprochazk
Copy link
Contributor Author

I tried setting rust-analyzer.completion.termSearch.enable to both true and false, and neither seems to have made a difference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants