Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/racer-rust/emacs-racer
Racer support for Emacs
https://github.com/racer-rust/emacs-racer
completion-racer emacs racer rust
Last synced: 7 days ago
JSON representation
Racer support for Emacs
- Host: GitHub
- URL: https://github.com/racer-rust/emacs-racer
- Owner: racer-rust
- Created: 2015-09-01T08:25:40.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2021-03-07T02:43:27.000Z (over 3 years ago)
- Last Synced: 2024-08-01T03:25:30.249Z (3 months ago)
- Topics: completion-racer, emacs, racer, rust
- Language: Emacs Lisp
- Size: 401 KB
- Stars: 399
- Watchers: 14
- Forks: 48
- Open Issues: 36
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
- awesome-rust-cn - emacs-racer - mode.github.io) and [auto-complete](https://github.com/auto-complete/auto-complete)) (Development tools / IDEs)
- awesome-rust - emacs-racer - mode.github.io) and [auto-complete](https://github.com/auto-complete/auto-complete)) (Development tools / IDEs)
- awesome-rust - emacs-racer - mode.github.io) and [auto-complete](https://github.com/auto-complete/auto-complete)) (Development tools / IDEs)
- awesome-rust-cn - emacs-racer
- awesome-rust-zh - emacs-racer - 自动补全(另见[company](https://company-mode.github.io)和[auto-complete](https://github.com/auto-complete/auto-complete)) (开发工具 / 集成开发环境(IDE))
- awesome-rust - emacs-racer - Autocompletion (see also [company](https://company-mode.github.io) and [auto-complete](https://github.com/auto-complete/auto-complete)) (Development tools / IDEs)
- awesome-rust - emacs-racer - mode.github.io) and [auto-complete](https://github.com/auto-complete/auto-complete)) (开发工具 Development tools / 编辑器 IDEs)
- fucking-awesome-rust - emacs-racer - Autocompletion (see also 🌎 [company](company-mode.github.io) and <b><code> 1723⭐</code></b> <b><code> 287🍴</code></b> [auto-complete](https://github.com/auto-complete/auto-complete))) (Development tools / IDEs)
- fucking-awesome-rust - emacs-racer - Autocompletion (see also 🌎 [company](company-mode.github.io) and <b><code> 1722⭐</code></b> <b><code> 287🍴</code></b> [auto-complete](https://github.com/auto-complete/auto-complete))) (Development tools / IDEs)
README
# Racer for Emacs
[![MELPA](http://melpa.org/packages/racer-badge.svg)](http://melpa.org/#/racer)
[![MELPA Stable](http://stable.melpa.org/packages/racer-badge.svg)](http://stable.melpa.org/#/racer)
[![Coverage Status](https://coveralls.io/repos/github/racer-rust/emacs-racer/badge.svg?branch=master)](https://coveralls.io/github/racer-rust/emacs-racer?branch=master)This is the official Emacs package for
[Racer](http://github.com/phildawes/racer).**Table of Contents**
- [Racer for Emacs](#racer-for-emacs)
- [Completion](#completion)
- [Find Definitions](#find-definitions)
- [Describe Functions and Types](#describe-functions-and-types)
- [Installation](#installation)
- [Testing your setup](#testing-your-setup)
- [Tests](#tests)## Completion
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](https://github.com/phildawes/racer/issues/389),
racer.el cannot offer completion for macros.## Find Definitions
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.
## Installation
1. You will need to use a nightly version of rust.
If you're using rustup, run
```
$ rustup toolchain add nightly
```2. Install [Racer](http://github.com/phildawes/racer) and download the
source code of Rust:```
$ rustup component add rust-src
$ cargo +nightly install racer
```3. Allow Emacs to install packages from MELPA:
```el
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
```4. Install the Emacs package for Racer: `M-x package-install RET racer RET`
5. Configure Emacs to activate racer when rust-mode starts:
```el
(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:
```el(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 `company-idle-delay` and
`company-minimum-prefix-length`.Racer process may be slow to respond for instance when indexing. You can
customize `racer-command-timeout` and `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.
Timeout of `nil` will wait indefinitely.### Testing your setup
To test **completion**: Open a rust file and try typing ```use
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.Press `C-x 4 .` to jump to its definition in another window.
Press `C-x 5 .` to jump to its definition in another frame.
Press `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.## Tests
racer.el includes tests. To run them, you need to install
[Cask](https://github.com/cask/cask), then:```
$ cask install
$ cask exec ert-runner
```