From 13a9e00fffb04024d91cb3160408455bebeb994f Mon Sep 17 00:00:00 2001 From: Jarmo Riikonen Date: Wed, 5 Jun 2019 09:49:02 +0300 Subject: [PATCH 1/3] Rust README to new format --- modules/lang/rust/README.org | 79 ++++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 35 deletions(-) diff --git a/modules/lang/rust/README.org b/modules/lang/rust/README.org index 7469620c3..61bd5908c 100644 --- a/modules/lang/rust/README.org +++ b/modules/lang/rust/README.org @@ -1,51 +1,60 @@ -#+TITLE: :lang rust +#+TITLE: lang/rust +#+DATE: June 5, 2019 +#+SINCE: {replace with next tagged release version} +#+STARTUP: inlineimages -#+begin_quote -This module is a work in progress. -#+end_quote +* Table of Contents :TOC_3:noexport: +- [[#description][Description]] + - [[#module-flags][Module Flags]] + - [[#plugins][Plugins]] +- [[#prerequisites][Prerequisites]] +- [[#features][Features]] +- [[#configuration][Configuration]] +- [[#troubleshooting][Troubleshooting]] + - [[#racer-installation-problems][Racer installation problems]] -This module adds [[https://www.rust-lang.org][Rust]] support to Emacs. +* Description +Add support to Rust-lang and cargo. +** Module Flags ++ ~+lsp~ to add support Language server protocol. + +** Plugins + Code completion (~racer~) + Syntax checking (~flycheck~) -+ Eldoc support (~go-eldoc~) -+ [[https://github.com/hlissner/emacs-snippets/tree/master/rust-mode][Snippets]] ++ Snippets -#+begin_quote -... -#+end_quote - -* Table of Contents :TOC: -- [[#install][Install]] - - [[#rust][Rust]] - - [[#dependencies][Dependencies]] - -* Install -** Rust +* Prerequisites To get started with Rust, you can either use =rustup= and install rust with: ~curl https://sh.rustup.rs -sSf | sh~ -Or through your package manager (which is my preference): +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]]) -*** MacOS -#+BEGIN_SRC sh :tangle (if (doom-system-os 'macos) "yes") -brew install rust -cargo install racer -#+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. -*** Arch Linux -#+BEGIN_SRC sh :dir /sudo:: :tangle (if (doom-system-os 'arch) "yes") -sudo pacman --needed --noconfirm -S rust rust-racer -#+END_SRC +Keybindings -** Dependencies -This module requires ~racer~ for code completion, which also requires access to Rust's source code. +| Binding | Description | +|---------------------+---------------| +| ~ b b~ | ~cargo build~ | +| ~ b c~ | ~cargo check~ | +| ~ b r~ | ~cargo run~ | +| ~ b t~ | ~cargo 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 -cargo install racer -git clone https://github.com/rust-lang/rust $RUST_SRC_PATH +rustup toolchain add nightly + +cargo +nightly install racer #+END_SRC - -Either set ~$RUST_SRC_PATH~ in your shell (so that it's available in Emacs), or adjust ~+rust-src-dir~ to point at the correct directory. - From b89e71fe7bc5d3827132ee89e73f101bbaf89c61 Mon Sep 17 00:00:00 2001 From: Jarmo Riikonen Date: Wed, 5 Jun 2019 09:59:44 +0300 Subject: [PATCH 2/3] Fixed some things in description and Plugins --- modules/lang/rust/README.org | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/lang/rust/README.org b/modules/lang/rust/README.org index 61bd5908c..16907490e 100644 --- a/modules/lang/rust/README.org +++ b/modules/lang/rust/README.org @@ -7,6 +7,7 @@ - [[#description][Description]] - [[#module-flags][Module Flags]] - [[#plugins][Plugins]] + - [[#hacks][Hacks]] - [[#prerequisites][Prerequisites]] - [[#features][Features]] - [[#configuration][Configuration]] @@ -14,15 +15,21 @@ - [[#racer-installation-problems][Racer installation problems]] * Description -Add support to Rust-lang and cargo. +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 -+ Code completion (~racer~) -+ Syntax checking (~flycheck~) -+ Snippets ++ [[https://github.com/rust-lang/rust-mode][Rust-mode]] ++ [[https://github.com/racer-rust/emacs-racer][Racer-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: From 7919825e4f1ff6c3de951655706301e1e66ba3bf Mon Sep 17 00:00:00 2001 From: Jarmo Riikonen Date: Wed, 5 Jun 2019 10:28:17 +0300 Subject: [PATCH 3/3] Fix to Troubleshooting link. --- modules/lang/rust/README.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/lang/rust/README.org b/modules/lang/rust/README.org index 16907490e..32f18b69d 100644 --- a/modules/lang/rust/README.org +++ b/modules/lang/rust/README.org @@ -37,7 +37,7 @@ 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]]) +required for ~racer~ from [[https://github.com/racer-rust/racer#installation][version 2.1]] (more info in [[#Troubleshooting][Troubleshooting]]) * Features This module also supports LSP, it requires installation of Rust Language Server