From 63b0ebeda781561b0c2b0c2128901e43d46b7092 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 7 Sep 2022 01:17:29 +0200 Subject: [PATCH] refactor!(rust): remove racer and default to +lsp BREAKING CHANGE: Racer is no longer developed and its project page recommends using rust-analyzer instead. Moreover, users have reported issues trying to build/install it on recent versions of rust, so I've removed support for Racer from Doom, and now default solely to LSP for IDE features. Users that want these features will need to activate the module's +lsp flag (along with the :tools lsp module) and install rust-analyzer. See the module's README for instructions. Close: #6705 Co-authored-by: c1ttim --- modules/lang/rust/README.org | 7 ++----- modules/lang/rust/autoload.el | 8 -------- modules/lang/rust/config.el | 9 --------- modules/lang/rust/packages.el | 2 -- templates/init.example.el | 2 +- 5 files changed, 3 insertions(+), 25 deletions(-) diff --git a/modules/lang/rust/README.org b/modules/lang/rust/README.org index d001f11f4..6b2e1e9bb 100644 --- a/modules/lang/rust/README.org +++ b/modules/lang/rust/README.org @@ -24,7 +24,6 @@ e.g. ~cargo~. ** Packages - [[doom-package:][rustic]] -- [[doom-package:][racer]] unless [[doom-module:][+lsp]] ** Hacks - rustic has been modified /not/ to automatically install lsp-mode or eglot if @@ -52,10 +51,8 @@ rustup update --no-self-update ** Other Requirements - If [[doom-module:][:editor format]] is enabled, you'll need =rustfmt=: ~$ rustup component add rustfmt-preview~. -- Users without [[doom-module:][+lsp]] enabled will need [[doom-package:][racer]]: ~$ cargo +nightly install racer~ - (with requires rust nightly edition). -- Users with [[doom-module:][+lsp]] enabled will need: - - =rust-analyzer= or =rls= +- Users with [[doom-module:][+lsp]] enabled will need [[https://rust-analyzer.github.io/][rust-analyzer]] (rls is supported, but + [[https://blog.rust-lang.org/2022/07/01/RLS-deprecation.html][deprecated]]). - Using the following commands requires: - ~cargo-process-check~: ~$ cargo install cargo-check~ - ~cargo-process-clippy~: ~$ rustup component add clippy-preview~ diff --git a/modules/lang/rust/autoload.el b/modules/lang/rust/autoload.el index d95e360b4..f02531a2c 100644 --- a/modules/lang/rust/autoload.el +++ b/modules/lang/rust/autoload.el @@ -7,14 +7,6 @@ "Return t if this is a cargo project." (locate-dominating-file buffer-file-name "Cargo.toml")) -;;;###autoload -(defun +rust-racer-lookup-documentation (identifier) - "A `+lookup/documentation' handler for Rust + Racer." - (let ((buf (racer--describe identifier))) - (when buf - (pop-to-buffer buf) - t))) - ;; ;;; Custom Cargo commands diff --git a/modules/lang/rust/config.el b/modules/lang/rust/config.el index c93e4d326..571a63077 100644 --- a/modules/lang/rust/config.el +++ b/modules/lang/rust/config.el @@ -76,12 +76,3 @@ (:prefix ("t" . "cargo test") :desc "all" "a" #'rustic-cargo-test :desc "current test" "t" #'rustic-cargo-current-test))) - - -(use-package! racer - :unless (modulep! +lsp) - :hook (rustic-mode-local-vars . racer-mode) - :config - (set-lookup-handlers! 'rustic-mode - :definition '(racer-find-definition :async t) - :documentation '+rust-racer-lookup-documentation)) diff --git a/modules/lang/rust/packages.el b/modules/lang/rust/packages.el index 5de32ac8a..5d8f5e8d4 100644 --- a/modules/lang/rust/packages.el +++ b/modules/lang/rust/packages.el @@ -2,5 +2,3 @@ ;;; lang/rust/packages.el (package! rustic :pin "6eec9713876d698510ee3715698fd42c1571e307") -(unless (modulep! +lsp) - (package! racer :pin "1e63e98626737ea9b662d4a9b1ffd6842b1c648c")) diff --git a/templates/init.example.el b/templates/init.example.el index f3041ec3b..bff0c70a2 100644 --- a/templates/init.example.el +++ b/templates/init.example.el @@ -164,7 +164,7 @@ ;;rest ; Emacs as a REST client ;;rst ; ReST in peace ;;(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"} - ;;rust ; Fe2O3.unwrap().unwrap().unwrap().unwrap() + ;;(rust +lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap() ;;scala ; java, but good ;;(scheme +guile) ; a fully conniving family of lisps sh ; she sells {ba,z,fi}sh shells on the C xor