Stream: t-compiler/wg-rls-2.0

Topic: RA not giving autocompletions for 'legion'-crate


Felix Rath (Mar 21 2020 at 15:47, on Zulip):

Hi,

(first time using zulip, so I hope opening a topic was correct to ask a question.)

I opened up the code of https://github.com/TomGillen/legion in an up-to-date vscode with rust-analyzer from the marketplace (under windows 10). It seems like, e.g., autocompletion is not working everywhere.

Things seem to work, for example, when I create a new function in src/lib.rs, and look for autocompletions there:

fn foobar() {
    use prelude;
    let u = prelude::Universe::new();
}

Now I get autocompletions when I type u., and types are shown correctly etc. The behavior seems to also be correct when I go to one of the files in one of the workspace members, i.e., "legion_core" or "legion_systems".

However, if I go to example/serialization/src/main.rs, and add a function there, like:

fn foobar2() {
    Universe::
}

Then I get no autocompletions (with the curser positioned after the ::).

The directory example seems to be simply a directory, which is also the base of a cargo workspace, with the two members "hello_world" and "serialization" ("serialization" is the one where autocompletions don't seem to work). It has a dependency for legion that looks like this:

legion = { path = "../..", features = ["serialize"] }

Maybe something is going wrong here?

Anyway, just wanted to report this. Can help debugging/provide logs etc., but I'm new to rust-analyzer so I have no idea what is needed, therefore just tell me what you would like to see/have me try.

Thanks! :)

Florian Diebold (Mar 21 2020 at 15:54, on Zulip):

Hmm I think the way RA works in VSCode is that it looks for the Cargo project in the root of the VSCode workspace folder. So if you have a completely separate Cargo workspace for the examples, I think you'll have to open it in a separate VSCode workspace (which will run a separate RA instance for that Cargo workspace).

Florian Diebold (Mar 21 2020 at 15:55, on Zulip):

actually it might be possible to have VSCode treat the examples folder as a separate workspace folder, I'm not sure.

Felix Rath (Mar 21 2020 at 15:57, on Zulip):

Ohh, thanks @Florian Diebold, that works! Awesome! :) I get why that is, a little bit annoying but I guess it's ok.

Felix Rath (Mar 21 2020 at 15:58, on Zulip):

Now to make it work in emacs :sweat_smile: :D

Last update: Sep 30 2020 at 16:00UTC