Git Product home page Git Product logo

racer's Introduction

Racer - code completion for Rust

alt text

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.

Important - Racer does not work with Rust Beta!

Racer uses unstable features from the standard library, and so currently requires a rust nightly install

Installation

  1. cd racer; cargo build --release

  2. Set the RUST_SRC_PATH env variable to point to the 'src' dir in your rust source installation

    (e.g. % export RUST_SRC_PATH=/usr/local/src/rust/src )

  3. Test on the command line:

    ./target/release/racer complete std::io::B (should show some completions)

Emacs integration

  1. Install emacs 24

  2. Install rust-mode. E.g. add the following to .emacs:

    (add-to-list 'load-path "<path-to-rust-mode-srcdir>/")
    (autoload 'rust-mode "rust-mode" nil t)
    (add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-mode))
    
  3. Install company mode. (e.g. via ELPA: M-x list-packages, select 'company')

  4. Set some variables and install racer. E.g. add this to .emacs:

    (setq racer-rust-src-path "<path-to-rust-srcdir>/src/")
    (setq racer-cmd "<path-to-racer>/target/release/racer")
    (add-to-list 'load-path "<path-to-racer>/editors")
    (eval-after-load "rust-mode" '(require 'racer))
    

(N.B. racer.el currenly relies on 'company'. The reason for all the 'eval-after-load' stuff is to ensure rust-mode and racer evaluate after company has been loaded)

  1. Open a rust file and try typing use std::io::B and press <tab>

  2. Place your cursor over a symbol and hit M-. to jump to the definition

Vim integration

  1. Install using Pathogen, Vundle or NeoBundle. Or, copy racer/plugin/racer.vim into your .vim/plugin directory.

Vundle users:

Vundle 'phildawes/racer'

NeoBundle users:

NeoBundle 'phildawes/racer', {
\   'build' : {
\     'mac': 'cargo build --release',
\     'unix': 'cargo build --release',
\   }
\ }
  1. Add g:racer_cmd and $RUST_SRC_PATH variables to your .vimrc. Also it's worth turning on 'hidden' mode for buffers otherwise you need to save the current buffer every time you do a goto-definition. E.g.:

    set hidden
    let g:racer_cmd = "<path-to-racer>/target/release/racer"
    let $RUST_SRC_PATH="<path-to-rust-srcdir>/src/"
    
  2. In insert mode use C-x-C-o to search for completions

  3. In normal mode type 'gd' to go to a definition

racer's People

Contributors

alkama avatar awdavies avatar bollu avatar byron avatar daboross avatar dahankzter avatar derekchiang avatar dotdash avatar ebfe avatar eklavya avatar geovex avatar gigapatches avatar golddranks avatar hatahet avatar hk47196 avatar iopq avatar jakerr avatar kiljacken avatar kui avatar leonardinius avatar maurizi avatar nlordell avatar oakes avatar phildawes avatar renato-zannon avatar shchvova avatar szotp avatar tafia avatar vincom2 avatar zsiciarz avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.