emacs-racer alternatives and similar packages
Based on the "Emacs" category
Do you think we are missing an alternative of emacs-racer or a related project?
Racer for Emacs
This is the official Emacs package for Racer.
<!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc-generate-toc again --> Table of Contents
- Racer for Emacs
<!-- markdown-toc end -->
racer.el supports code completion of variables, functions and modules.
[racer completion screenshot](images/racer_completion.png)
You can also press F1 to pop up a help buffer for the current completion candidate.
Note that due to a limitation of racer, racer.el cannot offer completion for macros.
racer.el can jump to definition of functions and types.
[racer go to definition](images/racer_goto.gif)
You can use M-. to go to the definition, and M-, to go back.
Describe Functions and Types
racer.el can show a help buffer based on the docstring of the thing at point.
[racer completion screenshot](images/racer_help.png)
Use M-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
Install Racer and download the source 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-annotations t)
For automatic completions, customize
Racer process may be slow to respond for instance when indexing. You can
racer-eldoc-timeout to avoid rendering
your Emacs session unresponsive. Eldoc timeout should be on the lower side and
defaults to 0.5 seconds. You can probably tweak it down on a fast machine.
nil will wait indefinitely.
Testing your setup
To test completion: Open a rust file and try typing
std::io::B and press TAB.
To test go to definition: Place your cursor over a symbol and press
M-. to jump to its definition.
C-x 4 . to jump to its definition in another window.
C-x 5 . to jump to its definition in another frame.
M-, to jump back to the previous cursor location.
If it doesn't work, try
M-x racer-debug to see what command was
run and what output was returned.
racer.el includes tests. To run them, you need to install Cask, then:
$ cask install $ cask exec ert-runner