Open Azorlogh opened 1 year ago
I think that this makes sense for things that are in prelude - but I don't think this is preferable in the situation where you want to change an import.
I agree, for prelude items this would make sense (and maybe glob imported ones). No need for a new assist though, we can just improve the already existing import assist.
Yes to be fair I think I've only ever needed it for prelude and globs, so I would be perfectly fine with just those. I'll rename the issue! :+1:
Use case
The anyhow crate provides the following definition:
If you create a new file, and use the type
Result<()>
somewhere, there is no way to automatically adduse anyhow::Result;
, because Result is already a type that exists.Proposed solution:
If the item under the cursor has been imported from prelude or a glob import, allow auto-importing an alternative item with the same name.
~~Provide a new assist for changing the import of the item under the cursor. If the item is defined in the current module, no assist is shown. If the item is already imported from a
use
, allow selecting an alternative import which replaces the old one. If the item is imported by default, like std's Result, allow selecting an import to hide it.~~