Stream: t-compiler/rust-analyzer

Topic: #503 finding public module path

Zac Pullar-Strecker (Jun 05 2020 at 02:54, on Zulip):

Hey I'm working on #503 and I'm trying to figure out how to find the public path to a symbol from the root module. Would doing a breadth/depth search from the root module via the crate_def_map be the best solution?

Zac Pullar-Strecker (Jun 05 2020 at 03:20, on Zulip):

Just found #3947, seems like it might be somewhat related?

std::Veetaha (Jun 05 2020 at 17:09, on Zulip):

@Kirill Bulatov worked on ImportsLocator, maybe he can share some knowledge on this topic?

Kirill Bulatov (Jun 06 2020 at 11:36, on Zulip):

If you just have a string representation of the symbol, you might check the ImportsLocator internals to see how to use the fuzzy text search we have.
Yet this is not very presise (does not consider macros expansions at all, for instance) and might misbehave in some cases like

I think the more proper approach would be to use something similar to the with additional improvements.

Zac Pullar-Strecker (Jun 06 2020 at 22:53, on Zulip):

Thanks, I'll take a look.

Last update: Jul 26 2021 at 12:15UTC