Rust Analyzer aggressive code completion

I love the code completion, but when I want to correct it or write something different it forcefully overwrites my changes. Most other IDE extensions will allow you to write what you want after deleting the code completion suggestion. I'm sad to say I had to disable rust-analyzer just to get my IDE to respect me again. I'll be happy to re-enable when it understands my intent to ignore the code completion.

You should open an issue on the rust-anaylzer repo, instead of posting here. cc @matklad

edit: TIL why this category exists

1 Like

Which IDE are you using? You should be able turn off completion if it's causing problems.

I personally use VS Code which so far has never completed something without my input and it doesn't stop me from overwriting anything. It does also show something called "inlay hints" which aren't really there, they just automatically annotate the type for the reader.

rust-analyzer does not apply completions unless you accept them manually. Something might be wrong with your setup or the plugin you're using.

1 Like


[Note: The rust-analyzer repo encourages users to post troubleshooting questions here, and they should be monitoring the "Editors and IDEs" category. The developers discussed this with us first, and we agreed to create the new category for this purpose.]


@chrisd I'm using VS Code. @jschievink I don't get any option of choosing, it aggressively corrects as I'm typing something it doesn't like. This is the rust-analyzer extension specifically. I considered these might be inlay hints but the code is actually changed, not just annotated. I have a number of other Rust-related extensions installed, but the problem goes away when I disable rust-analyzer. I'll concede there could be some side effects of this, it's just going to take a long time to narrow it down. Thanks everyone, I'll keep trying on my end.

If you happen to be able to record your screen, recording the bad behavior should help diagnose the issue.

(I can attest to OBS working well for that purpose, though it can be difficult to learn to use well.)

1 Like

Yup, seeing what exactly is changed without user interaction would be helpful.

We do apply some tiny fixups as a part of on type formatting request:

  • adding ; after typing let
  • indenting the . after starting new call in the method chain

Those can be disabled via settings (editor.formatOnType), but I am not sure if this is exactly what is happening here.

Well, it wasn't just this extension, I just saw a similar issue with a different language plugin, completely unrelated. I was a bit frustrated and switched to a different project, and it happened with .NET and webassembly. I reinstalled VS Code fresh and created new workspace file for my project. Right now only Rust and rust-analyzer are installed and it's behaving now. Super weird, but I can see now it's not the rust-analyzer plugin. Sorry for the confusion everyone, carry on.


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.