Skip to content

Autocomplete for fields of structs is not working(as expected) #12857

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

Closed
Rohithcheryala opened this issue Jul 23, 2022 · 2 comments · Fixed by #12861
Closed

Autocomplete for fields of structs is not working(as expected) #12857

Rohithcheryala opened this issue Jul 23, 2022 · 2 comments · Fixed by #12861
Assignees
Labels
A-completion autocompletion C-bug Category: bug E-easy E-has-instructions Issue has some instructions and pointers to code to get started

Comments

@Rohithcheryala
Copy link

Rohithcheryala commented Jul 23, 2022

Text Editor: VS Code
If I'm typing I field of struct I need self to be autocompleted for me by rust-analyzer,
Im getting the suggestion as self.field but after accepting the suggestion it is being replaced by field (self is missing).

Before:
lib rs - raytracer  WSL_ Ubuntu  - Visual Studio Code 24-07-2022 00_25_48

Hint is self.length and that is correct
After:
lib rs - raytracer  WSL_ Ubuntu  - Visual Studio Code 24-07-2022 00_28_12

It's being replaced by length not self.length.

rust-analyzer version: 0.4.1133-standalone (30c4db1 2022-07-19)

rustc version: rustc 1.64.0-nightly (7665c3543 2022-07-06)

relevant settings: everything default

@Veykril Veykril added A-completion autocompletion C-bug Category: bug labels Jul 23, 2022
@Veykril
Copy link
Member

Veykril commented Jul 23, 2022

We are overwriting the insert text here

item.insert_text(escaped_name);

but forget to account for when the receiver exists, so the label and insert text get out of sync.

@Veykril Veykril added E-easy E-has-instructions Issue has some instructions and pointers to code to get started labels Jul 23, 2022
@DorianListens
Copy link
Contributor

@rustbot claim

DorianListens added a commit to DorianListens/rust-analyzer that referenced this issue Jul 24, 2022
bors added a commit that referenced this issue Jul 24, 2022
…nListens

fix: Autocomplete for struct fields includes receiver

fixes #12857
@bors bors closed this as completed in 77acb5c Jul 24, 2022
Veykril pushed a commit to Veykril/rust-analyzer that referenced this issue Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-completion autocompletion C-bug Category: bug E-easy E-has-instructions Issue has some instructions and pointers to code to get started
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants