Skip to content

Trait item completions could work better #11860

@jonas-schievink

Description

@jonas-schievink

Given this code:

trait Tr {
    type Ty;
    const KONST: u8;
    fn required();
    fn provided() {}
}

impl Tr for () {
    $0
}

The completion we provide are generally pretty bad:

  • Requesting completions at $0 without typing anything else just shows generic completions. We should prioritize completions of missing trait items to be at the very top there.
    • (in fact I cannot find them in the list at all, do they only show up if at least one character is typed?)
  • Replacing $0 with fn and then requesting completions shows nothing. Instead, both required and provided should show up.
    • (the same happens when typing other keywords)
  • Applying the completion for Ty and KONST does not complete the required ; at the end, but the fn completions do include the function body and place the cursor inside.
  • Impl items generated by macros are still suggested.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-completionautocompletionC-bugCategory: bugS-actionableSomeone could pick this issue up and work on it right now

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions