GNU bug report logs -
#59214
[PATCH] Alternate rust-analyzer command added
Previous Next
Reported by: Pankaj Jangid <pankaj <at> codeisgreat.org>
Date: Sat, 12 Nov 2022 11:54:02 UTC
Severity: wishlist
Tags: patch
Done: João Távora <joaotavora <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
João Távora <joaotavora <at> gmail.com> writes:
> Pankaj, is it really that uncommon to have a tool installed as part of
> a Rust package be in the execution path of a shell? It's not uncommon
> in other toolchains with what I think are similar package architectures,
> such as Node JS.
Perhaps I wasn't clear enough.
The rust toolchain is similar to the tools of NodeJS world. Both try to
install packages/components in a standardised location. And users are
not required to move files and create links manually using OS level
commands like `cp', `ln' etc. `npm' and `rustup' commands do that for
users.
From the rust users mailing, as far as I have understood, the
maintainers are seeing `rust-analyzer' as a replacement for `rls'. And
`rust-analyzer' was recently moved from `nightly' to `stable'. They have
not yet placed `rust-analyzer' executable in PATH/exec-path, possibly
because they don't want to keep two executables for the same job. Or may
be they are thinking of keeping the name `rls'. Not sure though. But
`rustup run stable rust-analyzer' will work in all cases.
So my recommendation is that we keep just the `rustup' version and `rls'
as fallback. I have attached the updated patch.
[0001-Invoke-rust-analyzer-using-rustup.patch (text/x-diff, inline)]
From 727e362e142ae3d292bf7abed3b592e0dff36725 Mon Sep 17 00:00:00 2001
From: Pankaj Jangid <pankaj <at> codeisgreat.org>
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
This bug report was last modified 2 years and 186 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.