<!-- Troubleshooting guide: https://rust-analyzer.github.io/manual.html#troubleshooting Forum for questions: https://users.rust-lang.org/c/ide/14 Before submitting, please make sure that you're not running into one of these known issues: 1. on-the-fly diagnostics are mostly unimplemented (`cargo check` diagnostics will be shown when saving a file): #3107 Otherwise please try to provide information which will help us to fix the issue faster. Minimal reproducible examples with few dependencies are especially lovely <3. --> **rust-analyzer version**: 0.3.1958-standalone (5bf2f85c8 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: ```rs // lib.rs mod foo; pub fn a() { } ``` ```rs // foo.rs mod bar; pub fn b() { } ``` ```rs // bar.rs pub fn c() { } ``` 2. Through UI or JSON, change the setting `rust-analyzer.imports.prefix` to `plain` (the default). 3. In the body of `a()`, type `b` and use auto-import. Observe that `foo::b` is correctly imported. 4. In the body of `b()`, type `c` and use auto-import. Observe that `self::bar::c` is incorrectly imported; it should be `bar::c`.