rust-lang / rust-lang/rust-analyzer

modding with absolute path disables autocomplete

Open
#16,666 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-vfs C-bug S-blocked S-unactionable
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

rust-analyzer version: 0.3.1850-standalone (68c506fd6 2024-02-19)
rustc version: rustc 1.77.0-nightly (30dfb9e04 2024-01-14)

I'm writing a build script that automatically mods some other files. The build script generates it's output to some directory which then is included with the include! macro. The main file behaves correcty, the autocomplete treats the injected code as if the include macro didn't exist (which is expected). In the included files compile-errors are displayed correctly as well. Just autocomplete is not working. When modding the file manually in main.rs autocomplete starts working. Note that the modded file is in a different directory than src (still within the same vscode session tho)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported setup: a build script generates files outside src, main.rs includes them with include!, and another file is modded using an absolute path. Reproduce the difference between generated and manually declared modules in VS Code, then trace rust-analyzer's module-file discovery; done means autocomplete works in the externally generated modded files while existing diagnostics remain correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.