Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add LSP action to automatically import a trait when using one of its methods #6956

Open
TomAFrench opened this issue Jan 6, 2025 · 1 comment
Assignees

Comments

@TomAFrench
Copy link
Member

In #6882 we added a warning for situations where we're using a trait but it's not in scope. For the case where there's only a single candidate trait we can then automatically import it. This would make it much easier to update any legacy codebases (and generally be more ergonomic on new ones).

Rust also allows selecting from multiple candidate traits which would also be nice but can be done separately.

@asterite
Copy link
Collaborator

asterite commented Jan 6, 2025

Relatedly, when typing x. and the completion is a trait method, the trait method is inserted but not the corresponding import (because of how it used to work). So now we'd also need to add the corresponding import. I'll try to do both things in the same PR as they are kind of related.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants