Skip to content

Add more completion items for impl to handle common scenarios #19442

Closed
@Natural-selection1

Description

@Natural-selection1

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions