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: Thu, 17 Nov 2022 18:21:59 +0530
User-agent: Gnus/5.13 (Gnus v5.13)

"M. Ian Graham" <hello+emacs@miangraham.com> writes:

> Pankaj Jangid <pankaj@codeisgreat.org> wrote:
>
>> -(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")))

Given your valid arguments, the 1st patch would be recommended. Not the
above. Earlier patch was,

-(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")))

> Another open question and source of future bug reports: How does a
> rustup user make eglot work with the nightly release channel when
> stable is specified here?

> Nightly is required by some libraries, and a minority of people use it
> in development for improved error messages and other benefits.
>
> Are we asking those people to redefine eglot-server-programs?


Wow. This is good observation. Here is how rustup users do it. And maybe
I need to update the patch accordingly.

There are two ways to select the toolchain. One is the `rustup default
nightly' command. This sets the nightly toolchain globally. Another
approach is to create a file `rust-toolchain' in the project root
directory and just write the name of toolchain for the project; just
write `nightly' or `stable' on the first line and save. This is like
setting node version in `.nvm' file. Just for the project.

Also `rustup which rust-analyzer' command tells us the full path of the
`rust-analyzer' executable based on active toolchain. Inside Emacs, the
project specific setting (via rust-toolchain file) would be tricky to
pick up. But this will work for globally configured default toolchain.

Should we probe using `shell-command-to-string' and then insert the
value in `eglot-server-programs'? My suggestion would be that, we
include the stable `rust-analyzer' in Emacs and user can always override
if he/she wants to experiment.





reply via email to

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