rust-lang / rust-lang/rust-analyzer
Completion for tuple struct's indices is problematic
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
$ rust-analyzer --version
rust-analyzer 1 (825833c26 2023-03-19)
$ rustc --version
rustc 1.68.0 (2c8cc3432 2023-03-06)
Context: https://lists.gnu.org/archive/html/bug-gnu-emacs/2023-03/msg01295.html and João's response.
With this snippet:
// src/lib.rs
/// 0..=10
struct Foo(u32, u32, u32, u32, u32, u32, u32, u32, u32, u32, u32);
fn foo(f: Foo) -> u32 {
f.
}
Move cursor after "f." and type, for example, "1", and then issue completion. Apparently, according to João's test and analysis, RA tells the client that "0" and "1" are possible completion candidates for the position after "f.1".
This set of completion candidates is wrong: the possible candidates should be the following:
- "" (because "f.1" is a valid field)
- "0" (because "f.10" is also a valid field)
- definitely not "1" (because "f.11" is not a valid field).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue from the src/lib.rs snippet by placing the cursor after f.1 and requesting completion. Trace the tuple-field completion entry point and add coverage for the expected candidates: an empty completion, 0 for field 10, and no 1 for nonexistent field 11.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100