Stream: rustdoc

Topic: rust-analyzer code completion for librustdoc


view this post on Zulip Nixon Enraght-Moony (Mar 22 2021 at 17:18):

add to that the package metadata for rust-analyzer,

How do you do this?

view this post on Zulip Joshua Nelson (Mar 22 2021 at 17:22):

@Nelson J Morais could you make a pr upstreaming that change?

view this post on Zulip Nelson J Morais (Mar 22 2021 at 17:26):

yes I'll make it as soon I get out of a work meeting.

view this post on Zulip Nelson J Morais (Mar 22 2021 at 17:27):

@Nixon Enraght-Moony ill reply to you soon to help you out. can't right now.

view this post on Zulip Nelson J Morais (Mar 22 2021 at 19:14):

@Nixon Enraght-Moony so regarding rust-analyzer

view this post on Zulip Nelson J Morais (Mar 22 2021 at 19:16):

and code completion while hacking librustdoc

view this post on Zulip Nelson J Morais (Mar 22 2021 at 19:17):

you can add the following to Cargo.toml of librustdoc
[package.metadata.rust-analyzer] rustc_private = true

view this post on Zulip Nelson J Morais (Mar 22 2021 at 19:18):

after that you tell RA where your rust repo source code is with: (I'm using vscode here)

view this post on Zulip Nelson J Morais (Mar 22 2021 at 19:20):

by setting the rustcSource of RA in your settings.json like this
"rust-analyzer.rustcSource": "d:\\Code\\rust\\rust\\Cargo.toml", // ...

view this post on Zulip Nelson J Morais (Mar 22 2021 at 19:21):

point it to the Cargo.toml of the rust repo

view this post on Zulip Nelson J Morais (Mar 22 2021 at 19:23):

and you should start to get code completion for most of the code in librustdoc.
take note that the rustc_private key of RA will work for all projects/libs, modules, etc that have the
#![feature(rustc_private)] in it.

view this post on Zulip Nelson J Morais (Mar 22 2021 at 19:24):

I hope it help

view this post on Zulip Nelson J Morais (Mar 22 2021 at 19:39):

for the record, i've opened PR to add rustc_private = true to Cargo.toml here https://github.com/rust-lang/rust/pull/83389


Last updated: Oct 11 2021 at 22:34 UTC