Skip to content

"rust-analyzer.imports.prefix": "plain" is ignored when importing items defined in subdirectories #17271

Closed
@homchom

Description

rust-analyzer version: 0.3.1958-standalone (5bf2f85 2024-05-09)

rustc version: 1.78.0 (9b00956e5 2024-04-29)

editor or extension: VSCode

relevant settings: rust-analyzer.imports.prefix

to reproduce:

  1. Create a new project with the following src directory
├── lib.rs
├── foo.rs
├── foo
│   ├── bar.rs

and the following files:

// lib.rs
mod foo;

pub fn a() {
}
// foo.rs
mod bar;

pub fn b() {
}
// bar.rs
pub fn c() {
}
  1. Through UI or JSON, change the setting rust-analyzer.imports.prefix to plain (the default).
  2. In the body of a(), type b and use auto-import. Observe that foo::b is correctly imported.
  3. In the body of b(), type c and use auto-import. Observe that self::bar::c is incorrectly imported; it should be bar::c.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

C-bugCategory: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions