rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
13.8k stars 1.53k forks source link

Support `cargo install` and `cargo binstall` binary installation #16831

Open nyurik opened 3 months ago

nyurik commented 3 months ago

Manually downloading and unpacking binary from the release page is not the most "rusty" path. Rust users mostly expect cargo install rust-analyzer, or the faster binstall (which actually uses the release page automatically). Please support this mode of installation rather than the documented (but ugly):

$ mkdir -p ~/.local/bin
$ curl -L https://github.com/rust-lang/rust-analyzer/releases/latest/download/rust-analyzer-x86_64-unknown-linux-gnu.gz | gunzip -c - > ~/.local/bin/rust-analyzer
$ chmod +x ~/.local/bin/rust-analyzer
lnicola commented 3 months ago

Sigh, we should just switch to ZIP already..

nyurik commented 3 months ago

Sigh, turns out we have a far better approach -- rustup component add rust-analyzer -- i just didn't see it in the docs until AFTER i installed it with the curl, ran it, and it told me that i don't have that component installed. Perhaps we should add it at the top somewhere as a recommended way? Maybe even remove the release download info?

lnicola commented 3 months ago

It's not recommended, we don't backport changes, so your stable component is two months old, in the ideal case.

You can use the nightly one, that's just up to one week old, if nothing goes wrong (but things often do).

nyurik commented 3 months ago

Thx, I tried rustup +nightly component add rust-analyzer -- it installed, but I don't see any way to run it.

lnicola commented 3 months ago

rustup +nightly which rust-analyzer. Which editor are you using?

nyurik commented 3 months ago

I'm not using an editor - I need to run it as a CLI tool