Skip to content

Option for import path when re-exports exist — preferences/excludes #21914

@maeldroem

Description

@maeldroem

Use case

A crate (lib) I'm working on provides a global prelude module, from which programmers can quickstart the usage of the crate by doing crate_name::prelude::*;.

Internally though, I want to avoid relying on the prelude re-exports, and choose their original location instead and makes those imports independent from changes to the prelude's re-exports.

Unfortunately, completion suggestions from rust-analyzer will always suggest the shortest path to an item that is not yet imported.

Potential solutions

  1. Option to ignore re-exports
  2. Option to ignore a list of modules' re-exports
  3. Option to ignore a list of specific re-exports
  4. Option to enable prompting for disambiguation when multiple paths to an item in the same crate exist
  5. Option to "canonicalize" an import (i.e. "rephrase" an import path that uses a re-export to an import path to the original location of the item)

Thank you for considering this feature :)

PS: May be related to #20468 , but I'm not certain that it's about the same thing, as they talk more about external modules rather than internal re-exports.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-idegeneral IDE featuresC-featureCategory: feature request

    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