#+TITLE: lang/rust #+DATE: June 5, 2019 #+SINCE: {replace with next tagged release version} #+STARTUP: inlineimages * Table of Contents :TOC_3:noexport: - [[#description][Description]] - [[#module-flags][Module Flags]] - [[#plugins][Plugins]] - [[#hacks][Hacks]] - [[#prerequisites][Prerequisites]] - [[#features][Features]] - [[#configuration][Configuration]] - [[#troubleshooting][Troubleshooting]] - [[#racer-installation-problems][Racer installation problems]] * Description Add support to Rust language and cargo commands inside emacs. + Code completion (~racer~) + Syntax checking (~flycheck~) + Snippets ** Module Flags + ~+lsp~ to add support Language server protocol. ** Plugins + [[https://github.com/rust-lang/rust-mode][Rust-mode]] + [[https://github.com/racer-rust/emacs-racer][Racer-mode]] + [[https://github.com/racer-rust/emacs-racer][Cargo-mode]] ** Hacks {A list of internal modifications to included packages} * Prerequisites To get started with Rust, you can either use =rustup= and install rust with: ~curl https://sh.rustup.rs -sSf | sh~ Package manager is not recommended to install Nightly version of Rust what is required for ~racer~ from [[https://github.com/racer-rust/racer#installation][version 2.1]] (more info in [[#Troubleshooting][Troubleshooting]]) Some commands require additional crates to be installed to work, e.g. ~cargo add~. #+BEGIN_SRC sh rustup component add rustfmt rustup component add cargo-check rustup component add cargo-edit #+END_SRC * Features This module also supports LSP, it requires installation of Rust Language Server [[https://github.com/rust-lang/rls][~RLS~]]. To enable this you need to enable ~lsp~ in ~:tools~ section in ~init.el~ file. Keybindings | Binding | Description | |---------------------+-----------------------------| | ~ a~ | ~cargo add~ | | ~ b~ | ~cargo build~ | | ~ B~ | ~cargo bench~ | | ~ c~ | ~cargo check~ | | ~ C~ | ~cargo clippy~ | | ~ d~ | ~cargo doc~ | | ~ r~ | ~cargo run~ | | ~ s~ | ~cargo search~ | | ~ u~ | ~cargo update~ | | ~ t a~ | ~cargo test~ | | ~ t f~ | ~run tests in current file~ | | ~ t t~ | ~run current test~ | * TODO Configuration How to configure this module, including common problems and how to address them. * Troubleshooting ** Racer installation problems Racer need now ([[https://github.com/racer-rust/racer#installation][From 2.1 version]]) nightly version of Rust If you installed trough rustup #+BEGIN_SRC sh rustup toolchain add nightly cargo +nightly install racer #+END_SRC