Trying to setup Rust, installed on system and working, not seen in VSCodium
Hello everyone : )
I am pretty new to rust.
My env:
- OS/Kernal:
Linux nobara 6.3.12-204.fsync.fc37.x86_64 - Rustup ver:
rustup 1.26.0 - Cargo ver:
cargo 1.71.0
Issue:
- Within VSCodium cannot see rustup or cargo which is causing issues
sh-5.1$ cargo --version
sh: cargo: command not found
sh-5.1$ rustup --version
sh: rustup: command not found
- It then results in the below
[ERROR rust_analyzer::main_loop] FetchWorkspaceError:
rust-analyzer failed to load workspace: Failed to load the project at {path-to-project}/Cargo.toml: cd "{path-to-project}/*project-file*" && "cargo" "--version" failed: No such file or directory (os error 2)
Rustup and Cargo work fine from my Terminal
To resolve this I have tried modifying the path variable within VSCodium which appears to be different then my terminal path variable
$PATH from Terminal: /home/*myname*/.cargo/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/*myname*/.dotnet/tools
$PATH from VSCodium: /app/bin:/app/bin:/app/bin:/usr/bin:/home/*myname*/.var/app/com.vscodium.codium/data/node/bin:/home/*myname*/.var/app/com.vscodium.codium/data/cargo/bin:/home/*myname*/.var/app/com.vscodium.codium/data/python/bin:/home/*myname*/.var/app/com.vscodium.codium/data/gem/ruby/3.1.0/bin
Modified the VSCodium to: /app/bin:/app/bin:/app/bin:/usr/bin:/home/*myname*/.var/app/com.vscodium.codium/data/node/bin:/home/*myname*/.var/app/com.vscodium.codium/data/cargo/bin:/home/*myname*/.var/app/com.vscodium.codium/data/python/bin:/home/*myname*/.var/app/com.vscodium.codium/data/gem/ruby/3.1.0/bin:/home/*myname*/.cargo/bin
Following this the VSCodium Terminal can see the needed items for Rust:
sh-5.1$ cargo --version
cargo 1.71.0 (cfd3bbd8f 2023-06-08)
sh-5.1$ rustup --version
rustup 1.26.0 (5af9b9484 2023-04-05)
But Rust-Analyzer still fails to see Cargo even after reloading the workspace.
So at this time I am not sure if I am close or missing something else, any assitance would be greatly appreciated : )
Have a great day. Regards, SudoCory
same problem here:
[ERROR rust_analyzer::main_loop] FetchWorkspaceError: rust-analyzer failed to load workspace: Failed to load the project at any update?
i fixed my problem but was in vscodium flatpak @SudoCory maybe you should try that
solution: https://github.com/flathub/com.vscodium.codium/issues/112
I had a similar problem: rust-analyzer plug-in half-working in VSCodium installed via Flatpak (OS: Linux Mint 21.3 x86_64).
It had synthax highlighting, but gave errors when trying to auto-format and wasn't analyzing the code in real-time for errors.
Maybe it's a very dirty solution but it started working just after giving VSCodium some more access to the system with these 3 commands on the system bash.
flatpak override --user --filesystem=host com.vscodium.codium
flatpak override --user --share=network com.vscodium.codium
flatpak override --user --filesystem=/usr com.vscodium.codium