rust-lang / rust-lang/rust-analyzer

No "import trait" assist nor trait method completion on associated types

Open
#14,670 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-completion A-ty C-bug
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

When writing a custom Deserialize impl, typing something like D::Error::inval does not show any relevant completions, despite D::Error implementing serde's Error trait (this happens even when the trait is already in scope). Even when a full method name is typed out (eg invalid_type), there is no "import serde::de::Error" assist like there is in other cases.

While mostly rare, this is an easy papercut to run into when writing a custom Deserialize impl for a type, so it would be good to support it better.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the case in a custom Deserialize impl by trying completion on D::Error::inval and typing invalid_type with serde:🇩🇪:Error in scope. Trace the completion and import-assist entry points for associated types, then verify that trait methods are suggested and the serde:🇩🇪:Error import assist appears.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.