Skip to content

Inside impls, complete unimplemented functions #1046

@matklad

Description

@matklad

See #1022 (comment)

The idea is that for

trait T {
   fn foo();
}

impl T for () {
   |
}

We should get completions for foo. Specifically, the completion should trigger on fn keyword and on bare identifier (so that users who know about this feature can just type the identifier)

The code, responsible for completions, lives here:

https://github.com/rust-analyzer/rust-analyzer/blob/958df1276e3d97b189dcd9de974564011c70ef62/crates/ra_ide_api/src/completion.rs

To implement this feature, one has to add more info to CompletionContext and to create a separate completion module. Take a look at complete_fn_param which does somewhat similar magical completions.

This should also work for types and consts

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-completionautocompletionE-hardE-has-instructionsIssue has some instructions and pointers to code to get startedfunA technically challenging issue with high impactgood first issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions