Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
homchom opened this issue May 21, 2024 · 0 comments · Fixed by #17277
Assignees
Labels
C-bug Category: bug

Comments

@homchom
Copy link

homchom commented May 21, 2024

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.
@homchom homchom added the C-bug Category: bug label May 21, 2024
@Veykril Veykril self-assigned this May 22, 2024
@bors bors closed this as completed in 6a16749 May 22, 2024
lnicola pushed a commit to lnicola/rust that referenced this issue May 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants