VSCode and Rust

FreeBSD 13.1, fully updated packages and ports.

When trying to run a simple Rust program in VSCode got this error:

Code:
This platform (x64-freebsd) is not suported.

(the typo is not mine).

It seems that the rust-analyzer extension does not work on FreeBSD.

Otherwise cargo works fine, at least for some simple Rust programs.
 
First, use pkg install:
pkg install rust-analyzer
then find the file:
whereis rust-analyzer
always:
/usr/local/bin/rust-analyzer

and then find the vscode extensions directory, like:
~/.vscode-oss/extensions/ust-lang.rust-analyzer-0.3..../server/

cp -f /usr/local/bin/rust-analyzer ~/.vscode-oss/extensions/rust-lang.rust-analyzer-0.3..../server/rust-analyzer

That's ok.
 
"rust-analyzer.server.path": "~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rust-analyzer"
Maybe you could try to add this to your settings.json
With the correct path ofc
 
First, you should install rust with rustup, not pkg install.
Then run "$ rustup component add rust-analyzer"
then, check "rust-analyzer --version"
at last, replace "~/.vscode-oss/extensions/ust-lang.rust-analyzer-0.3..../server/rust-analyzer" with "/home/sam/.cargo/bin/rust-analyzer"
 
This trick isn't working. I tried the instructions above.

To be clear, I 'cd' to a folder where commands like 'cargo test' and 'cargo run' work. From there I launch vscode.

I then try to run the code from vscode. From the top menu, Run -> Start Debugging and Run -> Run without Debugging - both of these yield same 'not suported' (sic) error.

I can run cargo commands from the terminal window inside vscode but that's some weak sauce right there.
 
Back
Top