On Tue, Feb 04, 2025 at 08:58:42AM +0000, woshilapin wrote:
> > Dear Efraim, thank you for wrestling with the monumentous complexity of
> > the rust toolchain in order to package the rust tools for guix: I would
> > not be able to learn this language with your efforts. However, I can't
> > get completion for Rust's standard library std after installing the
> > packages given by the specs "rust" and "rust:tools" which includes
> > rust-analyzer.
> 
> Dear Kabelo,
> 
> For Rust's standard library completion, you might be missing `rust:rust-src` 
> variant of the package `rust`?
> 
> > Given the logs I have I think it's because
> > "rust-analyzer-proc-macro-srv" is missing.
> 
> I actually found out about the problem of `rust-analyzer-proc-macro-srv`. I 
> started working on a patch, and have something that I believe works. You can 
> try it on my channel for the moment [1]. Please tell if that works for you. 
> Note that you won't be able to refer to it by it's name, so you might need to 
> import the module and use the variable name `rust-1.82`. Here is a example of 
> a manifest working with it.
> 
> ```rust
> (use-modules (guix packages)
>              (guix profiles)
>              (gnu packages commencement)
>              (gnu packages llvm)
>              (gnu packages rust)
>              (tuziwo packages rust))
> 
> (packages->manifest (list clang
>                           gcc-toolchain-14
>                           pkg-config
>                           rust-1.82
>                           `(,rust-1.82 "cargo")
>                           `(,rust-1.82 "rust-src")
>                           `(,rust-1.82 "tools")
>                           rust-analyzer))
> ```
> 
> That said, the solution I have is not entirely satisfactory. I talked with 
> Efraim on last Friday (at the Guix Days) and we were trying to find a better 
> solution [2] to push it upstream. So still digging (when I find time).
> 
> I hope this helps.
> 
> [1]: https://gitlab.com/woshilapin/tuziwo-channel/
> [2]: 
> https://internals.rust-lang.org/t/how-to-install-rust-analyzer-proc-macro-srv-cli/22306
> 
> > 
> > Everyone else, any ideas about how to get lsp completion working for
> > std?
> > 

I spent some time working on it, and it looks like we are supposed to
install rust-analyzer-proc-macro-srv into /libexec. I've followed
upstream's recommendation and added it to the "out" output, albeit
manually because there isn't an install target for it.  I've also
wrapped rust-analyzer with it, and when rust-team is merged into master
again (eventually) it should be working.

In the meantime, if you want to try it out, 'guix time-machine
--branch=rust-team -- shell rust-analyzer' should provide a
rust-analyzer wrapped with rust:src and with
rust-analyzer-proc-macro-srv.

-- 
Efraim Flashner   <efr...@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

Attachment: signature.asc
Description: PGP signature

Reply via email to