- Notifications
You must be signed in to change notification settings - Fork279
Rust Code Completion utility
License
racer-rust/racer
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Racer - code completion forRust
RACER =RustAuto-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.
Racer isnot actively developped now.Please consider using newer software such asrust-analyzer.
NOTEFrom 2.1, racer needsnightly rust
If you're using rustup, run
rustup toolchain install nightlyrustup component add rustc-dev --toolchain=nightly
Note: The second command adds therustc-dev
component to the nightlytoolchain, which is necessary to compile Racer.
Internally, racer calls cargo as a CLI tool, so please make sure cargo is installed
Simply run:
cargo +nightly install racer
As mentioned in the command output, don't forget to add the installation directory to yourPATH
.
Clone the repository:
git clone https://github.com/racer-rust/racer.git
cd racer; cargo +nightly 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
automatically viarustup and run
rustup component add rust-src
in order to install the source to$(rustc --print sysroot)/lib/rustlib/src/rust/library
(or$(rustc --print sysroot)/lib/rustlib/src/rust/src
in older toolchains). Rustup will keep the sources in sync with the toolchain if you runrustup update
.manually from git:https://github.com/rust-lang/rust
Note
If you want to use
racer
with multiple release channels (Rust has 3 release channels:stable
,beta
andnightly
), you have to also download Rust source code for each release channel you install.e.g. (rustup case) Add a nightly toolchain build and install nightly sources too
rustup toolchain add nightly
rustup component add rust-src
(Optional) Set
RUST_SRC_PATH
environment variable to point to the 'src' dir in the Rust source installatione.g.% export RUST_SRC_PATH=$(rustc --print sysroot)/lib/rustlib/src/rust/library
or% export RUST_SRC_PATH="$(rustc --print sysroot)/lib/rustlib/src/rust/src"
(older)It's recommended to set
RUST_SRC_PATH
for speed up, but racer detects it automatically if you don't set it.Test on the command line:
racer complete std::io::B
(should show some completions)
Note
To complete names in external crates, Racer needsCargo.lock
.So, when you add a dependency in yourCargo.toml
, you have to run a build commandsuch ascargo build
orcargo test
, to get completions.
Racer is used as a static library inRLS
Racer can be used with Eclipse through the use ofRustDT. (User guide islinked in repo description)
Emacs integration has been moved to a separate project:emacs-racer.
Gedit integration can be foundhere.
Gnome Builder integration can be foundhere
The Kate community maintains aplugin. It is bundled with recent releases of Kate (tested with 16.08 - read morehere).
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 theanaconda plugins family that offers auto completion, goto definition and show documentation
Vim integration has been moved to a separate project:vim-racer.
Racer recommends the officialRust (rls)
extension based on RLS, which uses Racer for completion.
You can find the racer package for Atomhere
Kakoune comes with a builtin integration for racer auto completion.
About
Rust Code Completion utility
Resources
License
Uh oh!
There was an error while loading.Please reload this page.