Rust Analyzer won't work!

Previously I was using Rust vscode with RLS.
but now even after shifting to vscode + Rust Analyzer the issue persists.

Analyzer used to work for first few days. But now it has stopped completly. Even after Restart Analyzer server from vscode wont help.

Video

https://streamable.com/q76kn8

You are using the Rust extension, not the rust-analyzer extension. Uninstall / disable the Rust extension.

1 Like

hi, thanks for comment.
Its same even if its disabled. And previously I was using analyzer plugin from inside Rust settings.

Can you share your vscode settings.json

{

    

    "rust.rustup": {

        "toolchain": "stable-x86_64-pc-windows-msvc",

        "nightlyToolchain": "nightly-x86_64-pc-windows-msvc"

    },

    "rust.mode": "rls",

    "rust.rls": {

        "useRustfmt": true

    },

    "rust-analyzer.updates.askBeforeDownload": false,

    "rust-analyzer.cargo.noDefaultFeatures": true,

    "rust-client.engine": "rust-analyzer",

    "rust-client.updateOnStartup": true,

    "rust.rust-analyzer": {

    

    },

    "explorer.confirmDelete": false,

    "[rust]": {

        "editor.defaultFormatter": "matklad.rust-analyzer"

    },

    "rust-analyzer.cargo.loadOutDirsFromCheck": true,

    "rust-analyzer.checkOnSave.overrideCommand": null,

}

Yes, it's better to disable the rls extension and stick to rust-analyzer one. There's some preliminary support for rust-analyzer in the rls extension, but it is preliminary.

It's hard to say what exactly doesn't work here. I suggest trying simple hello world projects and steps from the troubleshooting section:

1 Like

it works sometimes like 2 out of 10 times.

I also had the same problem as you,reinstall rust-analyzer multiple times but it also couldn't work。

have you checked your CPU/usage? sometimes with more complex projects or slow CPU, rust analyzer will take some time to analyze your program before it starts being helpful.

its very simple project. trying to learn Rust.

1 Like

It works fine now, I did this following:

  1. Uninstalled from VScode all Rust plugins, & analyzer.
  2. Restarted machine
  3. install only Rust Analyzer
    And in settings when enabled "Cargo: All Features"

Also just found out. on Windows 10 + vscode + Rust Analyzer plugin, if you are using WSL v2 with Ubuntu 20.04 and when you launch code . inside your wsl terminal.
Rust works flawless. It even started to show me clippy suggestions which I could just fix it with ALT + ENTER
And I'm able to give build and run that code from windows folders as well.
C:\Users\ajink\RustProjects\pipeviewer

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.