From 727e362e142ae3d292bf7abed3b592e0dff36725 Mon Sep 17 00:00:00 2001 From: Pankaj Jangid Date: Thu, 17 Nov 2022 11:25:16 +0530 Subject: [PATCH] Invoke rust-analyzer using rustup * lisp/progmodes/eglot.el (eglot-server-programs): There are two ways to run rust-analyzer. After adding the rustup component, users can add rust-analyzer executable to PATH/exec-path using OS level `cp' or `ln' commands and then run rust-analyzer directly or they may run ``rustup run stable rust-analyzer'' command without making PATH changes. 2nd command is the preferred way to invoke the language server because it doesn't require user to manually create link inside `~/.cargo/bin'. --- lisp/progmodes/eglot.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 12808e80c4..fb95313aa0 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -181,7 +181,7 @@ eglot-alternatives when probe return (cons probe args) finally (funcall err))))))) -(defvar eglot-server-programs `((rust-mode . ,(eglot-alternatives '("rust-analyzer" "rls"))) +(defvar eglot-server-programs `((rust-mode . ,(eglot-alternatives '(("rustup" "run" "stable" "rust-analyzer") "rls"))) (cmake-mode . ("cmake-language-server")) (vimrc-mode . ("vim-language-server" "--stdio")) (python-mode -- 2.30.2