bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#59214: [PATCH] Alternate rust-analyzer command added


From: Pankaj Jangid
Subject: bug#59214: [PATCH] Alternate rust-analyzer command added
Date: Sat, 12 Nov 2022 18:39:50 +0530
User-agent: Gnus/5.13 (Gnus v5.13)

Eli Zaretskii <eliz@gnu.org> writes:

>> I meant "link rust-analyzer executable into a directory which is covered
>> by PATH environment variable".
>
> Then please modify the commit log message to use "PATH", upper-case.
>

Sure. Attached is the updated patch.

>> Typically, rust programmers have
>> ~/.cargo/bin directory added to PATH env variable. So the official
>> rust-analyzer documentation suggests that either you link rust-analyzer
>> to this location or run using command `rustup run stable rust-analyzer'.
>> 
>> Ref: https://rust-analyzer.github.io/manual.html#rustup
>
> I'll defer to João in the decision of whether we want to support both
> methods or just one of them.

Sure. Just to add to my pitch. The additional method is a fallback that
I added because I do not touch the ~/.cargo/bin directory by hand and
let `rustup' handle this. There may be few other users like me.

Of course decision is João's.

>From 7915d320d87acbb807dde00acd9ce2c8237ed048 Mon Sep 17 00:00:00 2001
From: Pankaj Jangid <pankaj@codeisgreat.org>
Date: Sat, 12 Nov 2022 17:21:56 +0530
Subject: [PATCH] Alternate rust-analyzer command added

* 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 to PATH and run rust-analyzer directly
or they may run ``rustup run stable rust-analyzer'' command. This
revision adds the 2nd command to the list of server programs.
---
 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 63ebbe6cab..f54c2d2c3a 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 
'("rust-analyzer" ("rustup" "run" "stable" "rust-analyzer") "rls")))
                                 (cmake-mode . ("cmake-language-server"))
                                 (vimrc-mode . ("vim-language-server" 
"--stdio"))
                                 (python-mode
-- 
2.30.2


reply via email to

[Prev in Thread] Current Thread [Next in Thread]