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 more completion items for impl to handle common scenarios #19442

Closed
Natural-selection1 opened this issue Mar 24, 2025 · 0 comments
Closed
Labels
A-completion autocompletion C-feature Category: feature request

Comments

@Natural-selection1
Copy link
Contributor

Currently, the completion for "impl" only provides the basic "impl" snippet. While this is universally applicable, I believe it overlooks adaptation for common usage scenarios - which is precisely where code completion should excel. Therefore, I propose adding more relevant completion items.

Image

According to the Rust Reference, I suggest adding these two items would be appropriate:

add_keyword("impl for", "impl $1 for $2 {\n    $0\n}");
add_keyword("impl<> for <>", "impl<$4> $1 for $2<$3> {\n    $0\n}");

However, I would like to gather opinions regarding:

  1. The naming conventions for these two items
  2. The cursor navigation order in the second snippet (the current version reflects what I consider to be a reasonable sequence)

The current proposals represent my initial thoughts on optimal implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-completion autocompletion C-feature Category: feature request
Projects
None yet
Development

No branches or pull requests

2 participants