How to navigate to implementation of and enable auto-completion for methods from traits with rust-analyser?

Let's say I convert &[u8] to Vec<u8> calling into() on the instance of the first. Compiler is happy, but rust-analyser does not navigate to the implementation with Go to Implementations menu. Ctrl+Click navigates to trait definition, which is not very helpful. What is your way of navigating to and finding the right implementation of a trait?

Also, intellisense auto-completion after . lists all methods accepting self instance as long as these methods are imported in scope. If these are not imported and you know method name exists (like .into()) compiler is unhappy but gives you a proposal what imports you can possibly do to have the method available. Is there any way to have these "compiler suggestions" available in intellisence auto-completion?

I am not sure if people asked about it before. If not it is a feature request, @matklad :slight_smile: Makes sense?

This is not yet implemented.

It is not available, but I heard someone is working on this. It may take a while for it to be implemented though for technical reasons.

Just to clarify, while we don't provide auto-completion here, you can auto-import the trait


EDIT: and now I can't stop thinking about the missing :...

1 Like

Sure. the main challenge for me is to learn what possible extension methods are available. More you read other's code, more you discover these methods. For example, now I know there is try_into, before I was only aware about into. If the editor provided all possible potential suggestions, it would simplify discovery of libs and rust in general.

No disagreement here! It's just there's a lot of stuff to implement, and there are only so many people working on it :slight_smile: Today's IDE support in Rust is in very early days.

1 Like

I understand. I think IDE support is already very good. At least I am enjoying it more now than 2-3 years ago. The difference is major. Especially after I switched to rust-analyzer.

I can easily convince C/C++ developers that IDE support for Rust is comparable with support for C/C++. I can not convince C# or Java/Scala developers, Visual Studio for C# is far ahead.

1 Like

I'm assuming this is about VS Code?

CLion can do this:

And honestly I think without it I wouldn't have had the patience to learn Rust.

Yes, it is about VS Code. And it can do the same if the methods are imported in scope. Can CLion do it if there is no import in scope?


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.