rust-lang / rust-lang/rust-analyzer
Suggest a prelude glob import if you try to import an item inside of one
Open
Nobody has claimed this yet.
A-assists
C-feature
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
I'd love to have the opportunity to import a full <crate>::prelude::* when importing an item that is inside of that prelude.
Example
foo.context(NotEnoughFrobnicationSnafu)?;
~~~~~~~ <context is the ResultExt::context trait fn from snafu, but the trait is not imported yet>
On opening the suggestions, currently it shows: "import snafu::ResultExt".
I'd like to have a second option "import snafu::prelude::*".
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files or tests are named. Start by tracing the code that produces the existing “import snafu::ResultExt” suggestion, then identify where an alternate prelude suggestion can be added; done means offering snafu::prelude::* alongside the item import when appropriate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100