Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Rust Code Completion utility

License

NotificationsYou must be signed in to change notification settings

racer-rust/racer

Repository files navigation

Build Status

racer completion screenshot

racer eldoc screenshot

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.

DISCLAIMER

Racer isnot actively developped now.Please consider using newer software such asrust-analyzer.

Installation

NOTEFrom 2.1, racer needsnightly rust

Requirements

Current nightly 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.

Cargo

Internally, racer calls cargo as a CLI tool, so please make sure cargo is installed

Withcargo install

Simply run:

cargo +nightly install racer

As mentioned in the command output, don't forget to add the installation directory to yourPATH.

From sources

  1. Clone the repository:git clone https://github.com/racer-rust/racer.git

  2. cd racer; cargo +nightly build --release. The binary will now be in./target/release/racer

  3. Add the binary to yourPATH. 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

Configuration

  1. Fetch the Rust sourcecode

    1. automatically viarustup and runrustup 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.

    2. manually from git:https://github.com/rust-lang/rust

    Note

    If you want to useracer 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

  2. (Optional) SetRUST_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 setRUST_SRC_PATH for speed up, but racer detects it automatically if you don't set it.

  3. 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.

Editors/IDEs Supported

RLS

Racer is used as a static library inRLS

Eclipse integration

Racer can be used with Eclipse through the use ofRustDT. (User guide islinked in repo description)

Emacs integration

Emacs integration has been moved to a separate project:emacs-racer.

Gedit integration

Gedit integration can be foundhere.

Builder integration

Gnome Builder integration can be foundhere

Kate integration

The Kate community maintains aplugin. It is bundled with recent releases of Kate (tested with 16.08 - read morehere).

  1. Enable 'Rust code completion' in the plugin list in the Kate config dialog;

  2. On the new 'Rust code completion' dialog page, make sure 'Racer command' and 'Rust source tree location' are set correctly.

Sublime Text integration

The Sublime Text community maintains some packages that integrates Racer

Vim integration

Vim integration has been moved to a separate project:vim-racer.

Visual Studio Code extension

Racer recommends the officialRust (rls) extension based on RLS, which uses Racer for completion.

Atom integration

You can find the racer package for Atomhere

Kakoune integration

Kakoune comes with a builtin integration for racer auto completion.


[8]ページ先頭

©2009-2025 Movatter.jp