Code actions are no longer available

I appreciate everyone's patience with this explanation; I will try to be as clear as I can.

As the title indicates, the TL;DR is that the code actions prompts I get from Rust Analyzer are either not available, or do not seem relevant. A fix would be great, but any advice for a beginner would be appreciated, as my internet searching has found no similar results. Advice on the following questions is what I am interested in:
Would a complete uninstall and reinstall of Rust fix this?
Would installing Leptos have had anything to do with this?
What rust commands on the command line be useful here?

For example, here is the case of a missing semi-colon. In the next three screenshots, you will see:
The output of clippy with a simple 'add ";" here' message.
The most obvious code action in the number 2 position.
Completely irrelevant options to implement.

This is what I would expect from the command line.

I can see that something is generating the right diagnostic here.

Hitting neovim's code action generates this noise:

I have tried to investigate by opening the same code in VSCodium, with these results:

Same output from the Terminal

Complete lack of code actions (the yellow bulb that should appear in the gutter is absent)

Unfortunately, I cannot tell when this issue began as it took a while to notice that basic things were missing. Neovim updated to 0.11 around the time that I installed Leptos, and I was skipping between different projects at the time, so I do not know which change may have caused this.
I have also tried reworking my nvim config a few times, but given this issue is also in VSCodium, it feels like an issue with Rust Analyzer itself, and it's here I am lost.

Thanks again.

The diagnostic is from rustc here, and rust-analyzer is only showing it. I don't think something has changed recently wrt. how rust-analyzer handles such diagnostics, but maybe the compiler no longer emits them in the JSON output?

Have you checked that you have an up-to-date version of RA in case you recently updated rustc? It is possible that an old RA might not work with a new rustc.

Regularly running rustup update, which checks rustc and rust-analyzer.
Trying now to run cargo check in RustRover and it's not picking up anything.

Does it happen in all projects or one specific project? What if you make a new dummy project with cargo new?

I don't think this is a RA issue if cargo check is also affected. Perhaps some complex macros are interacting badly with cargo check?

Here's a new project with the same issue of a missing colon. I am just expecting the "add ; here" option. So I can get clippy to suggest the ';', but clippy doesn't seem to feed the suggestions back to the IDE.
I tried to isolate it to just NeoVim, but I can recreate similar issues in RustRover, that has barely had any customization.


Note that with NeoVim you're probably using RustAnalyzer, but with RustRover there is no RustAnalyzer in use (JetBrains has their own analyzer). So there is nothing in common except the Rust compiler and the Rust language syntax.

Apparently neither product will give you a code action for adding a semicolon. Looks like the error message is clear. Since all you have to do is type a single ; character, it may not be something seen as appropriate for a code action.

I appreciate the feedback, but the missing colon is just the easiest example to recreate for demonstrating the problem.
I used to get code actions for both the simple things like missing colons and more complex issues like misusing the turbofish, for example.
Now, since about 1.85 (I think), none of the code action suggestions ever seem to match the output from clippy, rustc, or rust-analyzer, and the issue replicates across NeoVim, RustRover and VSCode.
So this is why I am asking for advice on where to look or what to investigate.
I'd rather not have to try a full reinstall if there is, for example, a RA option that is something like "turn on assists" (which is what RA calls code actions), but I cannot seem to find anything in the book, the man pages, or forums to suggest anything like that.

As I say, if the problem happens in RustRover then it is not related to RA. RustRover doesn't use RA.


Separately, I was wrong about the following statement because I do get a code action from RA for adding a missing semicolon:

1 Like

I can't be sure that I remember this correctly, but I thought I saw the missing colon code action spawning from rustc, not RA. Could it be a setting with the rustc compiler?

Outside of the IntelliJ ecosystem, rust-analyzer is the one responsible for presenting the rustc errors to the editor. If rust-analyzer doesn't work, you won't get rustc errors in your editor either.

The code actions are not coming from rustc. They are coming from RA or the equivalent in RustRover.

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.