Let's talk about Rust for a moment, folks. If C is akin to the Bourgeoise, then Rust is kind of like Robin Hood. It takes ideas from C, and implements them in safe and better ways. In my opinion, it's almost foolish to start a new C project today, with all the extensibility of the High-level languages today and the safety and relative ease-of-use of languages like Rust and Go. One front where Rust is lacking, however, is IDE integration. At the time of writing, there is an Active RFC for features in the Rust compiler that will make it easier for IDE plugin authors to add Rust integration. Thankfully, in the interim, there's the Racer project which does something similar.
What does Racer do?
Racer provides automcompletion for Rust code. It does this by sending incomplete symbols in your Rust source file to racer, searching the standard library for a candidate, and providing the name and type information as you go.
So, in order for Racer to work, we need the Rust source code.
How do I install Racer?
The easiest way is with Cargo, Rust's package manager. The following commands should get you up and running. You need to have cargo, rustc, and git installed for these to work.
**NOTE FOR ZSH USERS**
In the following commands, simply replace .bashrc with .zshrc. Everything else should stay the same.
Install racer from crates.io
cargo install racer
Add the cargo directory to your $PATH variable
echo "export PATH=\"\$PATH:$HOME/.cargo/bin\"" >> .bashrc
Download the rust source code
git clone --depth 1 https://github.com/rust-lang/rust.git $HOME/.rustsrc
Set your RUST_SRC_PATH environment variable to look for your rust src checkout
echo "export RUST_SRC_PATH=\"$HOME/.rustsrc/src\"" >> .bashrc
No comments:
Post a Comment