Racer - code completion for Rust
RACER = Rust Auto-Complete-er. A utility intended to provide Rust code completion for editors and IDEs. Maybe one day the 'er' bit will be exploring + refactoring or something.
This method requires Rust 1.5. Simply run:
cargo install racer
As mentioned in the command output, don't forget to add the installation directory to your PATH
.
-
Clone the repository:
git clone https://github.com/phildawes/racer.git
-
cd racer; cargo build --release
. The binary will now be in./target/release/racer
-
Add the binary to your
PATH
. This can be done by moving it to a directory already in yourPATH
(i.e./usr/local/bin
) or by adding the./target/release/
directory to yourPATH
-
Fetch the Rust sourcecode from git, or download from https://www.rust-lang.org/install.html (the 'rustc' source download behind the 'source' link is the right one)
-
Set the
RUST_SRC_PATH
environment variable to point to the 'src' dir in the Rust source installation(e.g.
% export RUST_SRC_PATH=/usr/local/src/rust/src
) -
Test on the command line:
racer complete std::io::B
(should show some completions)
Note for rustup users
This does not apply to multirust!
To enable completion for cargo crates, you need to set the CARGO_HOME
environment variable to .cargo
in your home directory.
Racer can be used with Eclipse through the use of RustDT. (User guide is linked in repo description)
Emacs integration has been moved to a separate project: emacs-racer.
Gedit integration can be found here.
The Kate community maintains a plugin. It will be bundled with future releases of Kate (read more here).
-
Enable 'Rust code completion' in the plugin list in the Kate config dialog;
-
On the new 'Rust code completion' dialog page, make sure 'Racer command' and 'Rust source tree location' are set correctly.
The Sublime Text community maintains some packages that integrates Racer
- RustAutoComplete that offers auto completion and goto definition.
- AnacondaRUST from the anaconda plugins family that offers auto completion, goto definition and show documentation
Vim integration has been moved to a separate project: vim-racer.
You can find more info about Visual Studio Code extension here.
You can find the racer package for Atom here