VScode auto completion circular dependencies issue

Hi, I have a very annoying issue with auto completion, here is my setup:
I have 4 libraries:

  1. Provider
  2. Slasher
  3. Staking
  4. Testing

Provider, Staking and Slasher dev-depend on Testing, but Testing also depend on all of them (to do testing stuff for them).
Provider was dev-depending on Slasher before I made the Testing library, but I removed it.
Sorry if thats confusing, hopefully will be less confusing from now :slight_smile:

In Testing I need to import a struct from Provider, the issue is it doesn't give me auto completion for this struct (and the whole Provider library), when I hover over this struct, it say {unknown}, but everything else works.
So it gives me error when I use wrong type, it gives me errors when the struct missing fields, cargo doesn't complain, etc.

But for some reason the auto completion just ignores the Provider library completely, but rust-analyzer does correctly parse it and give me errors.

My first thought was its because Testing depend on Provider, and Provider dev-depend on Testing, but thats the same case for the Staking library, and the auto completion works perfectly fine for Staking.

My second thought was maybe cache is involved? because I have 2 libraries which previously dev-depend on other libraries, and the auto completion issue is for both of those, but other 2 libraries didn't previously depend on any other library, and they don't have this issue.
But right now, all libraries only dev-depend on Testing and no other library.
I tried removing rust-analyzer, but it didn't work, is there a better way to maybe delete cache?

As you can see, there is no error in first line, but it doesn't find mesh_provider on the second line.

rust-analyzer currently doesn't deal well with dependency cycles involving dev dependencies. It will just ignore whatever dependency closes the cycle, so I think it's basically random which dependency doesn't work. It's a known issue.

Interesting, Do you know if theres any plans to address this issue? seems like no, its really annoying :frowning:

There are plans, yes, but it's a rather complicated problem and it will probably not be fixed in the near term.

1 Like

Thank you for your help!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.