Difference between revisions of "Rust"

From WikEmacs
Jump to navigation Jump to search
(flycheck)
(racer support)
Line 28: Line 28:
  
 
See [https://github.com/flycheck/flycheck-rust flycheck-rust] (on MELPA). See [[Flycheck]].
 
See [https://github.com/flycheck/flycheck-rust flycheck-rust] (on MELPA). See [[Flycheck]].
 +
 +
= Emacs-racer =
 +
 +
See [https://github.com/racer-rust/emacs-racer emacs-racer] (also in MELPA) for documentation and screencasts. It provides:
 +
 +
* code completion of variables, functions and modules (not macros yet due to a racer limitation) (see also [[company-mode]])
 +
* '''jump to definition''' (bound to '''M-.''')
 +
* '''describe functions and types''',
  
 
[[Category:Programming languages]]
 
[[Category:Programming languages]]
 
[[Category:Programming]]
 
[[Category:Programming]]

Revision as of 14:49, 22 May 2017

Let's setup Emacs for Rust development, shall we ?

rust-mode

rust-mode (in MELPA) offers:

  • syntax highlighted,
  • code formatting, optionally automatic,
  • Imenu support,
  • navigation by semantics (go to the beginning or end of the current defun), (see also helm-swoop, helm-ag, tags,…)
  • playpen helpers (send the selected code to play.rust-lang.org),

In Debian testing and unstable you can also install it with apt install elpa-rust-mode (but the MELPA way is prefered).


700px

Code formatting with rustfmv

Formatting is also provided by this mode. If you want auto formatting everytime you save a buffer, put this in your Init File:

(setq rust-format-on-save t)

On-the-fly syntax checking: Flycheck-rust

See flycheck-rust (on MELPA). See Flycheck.

Emacs-racer

See emacs-racer (also in MELPA) for documentation and screencasts. It provides:

  • code completion of variables, functions and modules (not macros yet due to a racer limitation) (see also company-mode)
  • jump to definition (bound to M-.)
  • describe functions and types,