- Notifications
You must be signed in to change notification settings - Fork46
racer-rust/emacs-racer
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is the official Emacs package forRacer.
Table of Contents
racer.el supports code completion of variables, functions and modules.
You can also pressF1 to pop up a help buffer for the currentcompletion candidate.
Note that due to alimitation of racer,racer.el cannot offer completion for macros.
racer.el can jump to definition of functions and types.
You can useM-. to go to the definition, andM-,to go back.
racer.el can show a help buffer based on the docstring of the thing atpoint.
UseM-x racer-describe to open the help buffer.
You will need to use a nightly version of rust.If you're using rustup, run
$ rustup toolchain add nightly
InstallRacer and download thesource code of Rust:
$ rustup component add rust-src$ cargo +nightly install racer
Allow Emacs to install packages from MELPA:
(require'package)(add-to-list'package-archives '("melpa"."https://melpa.org/packages/"))
Install the Emacs package for Racer:
M-x package-install RET racer RET
Configure Emacs to activate racer when rust-mode starts:
(add-hook'rust-mode-hook#'racer-mode)(add-hook'racer-mode-hook#'eldoc-mode)
For completions, install company with
M-x package-install RET company RET
. A sample configuration:(add-hook'racer-mode-hook#'company-mode)(require'rust-mode)(define-key rust-mode-map (kbd"TAB")#'company-indent-or-complete-common)(setq company-tooltip-align-annotationst)
For automatic completions, customize
company-idle-delay
andcompany-minimum-prefix-length
.Racer process may be slow to respond for instance when indexing. You cancustomize
racer-command-timeout
andracer-eldoc-timeout
to avoid renderingyour Emacs session unresponsive. Eldoc timeout should be on the lower side anddefaults to 0.5 seconds. You can probably tweak it down on a fast machine.Timeout ofnil
will wait indefinitely.
To testcompletion: Open a rust file and try typinguse std::io::B
and pressTAB.
To testgo to definition: Place your cursor over a symbol and pressM-.
to jump to its definition.
PressC-x 4 .
to jump to its definition in another window.
PressC-x 5 .
to jump to its definition in another frame.
PressM-,
to jump back to the previous cursor location.
Ifit doesn't work, tryM-x racer-debug
to see what command wasrun and what output was returned.
racer.el includes tests. To run them, you need to installCask, then:
$ cask install$ cask exec ert-runner
About
Racer support for Emacs
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.