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

Racer support for Emacs

NotificationsYou must be signed in to change notification settings

racer-rust/emacs-racer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MELPAMELPA StableCoverage Status

This is the official Emacs package forRacer.

Table of Contents

Completion

racer.el supports code completion of variables, functions and modules.

racer completion screenshot

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.

Find Definitions

racer.el can jump to definition of functions and types.

racer go to definition

You can useM-. to go to the definition, andM-,to go back.

Describe Functions and Types

racer.el can show a help buffer based on the docstring of the thing atpoint.

racer completion screenshot

UseM-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. InstallRacer and download thesource code of Rust:

    $ rustup component add rust-src$ cargo +nightly install racer
  3. Allow Emacs to install packages from MELPA:

    (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:

    (add-hook'rust-mode-hook#'racer-mode)(add-hook'racer-mode-hook#'eldoc-mode)

    For completions, install company withM-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, customizecompany-idle-delay andcompany-minimum-prefix-length.

    Racer process may be slow to respond for instance when indexing. You cancustomizeracer-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.

Testing your setup

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.

Tests

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

Stars

Watchers

Forks

Packages

No packages published

Contributors29


[8]ページ先頭

©2009-2025 Movatter.jp