Vscode-rust: Must reload VSCode window after adding lib.rs to binary project to resolve `use`

Created on 11 Dec 2019  ·  4Comments  ·  Source: rust-lang/vscode-rust

Adding the default lib.rs file in a binary project and importing from it with use from main.rs reports an unresolved import error from RLS.

Steps to reproduce

  1. cargo init proj_name
  2. Open VSCode in folder proj_name
  3. open main.rs (RLS initializes)
  4. add lib.rs (optionally add a public test function in it)
  5. add use proj_name::* (or pub fn name) to main.rs

What happens

RLS reports unresolved import 'proj_name', while cargo build passes without warning.
Must Reload Window in VSCode to resolve the reported error.

What should happen

The import to the project library is resolved. The new file is recognized or lib.rs existence is checked on use <crate name>

Versions

Rust & rls: 1.39.0 & 1.39.0 (80a1d34)
VSCode RLS extension: 0.7.0
Platform Win 10 + WSL2 (RLS on Ubuntu 18.04)

Most helpful comment

Is this fixed in 0.7.0 or will we need to wait for another update? I'm still experiencing this issue.

All 4 comments

Failed to reproduce on rls nightly-2019-12-12.

Is this fixed in 0.7.0 or will we need to wait for another update? I'm still experiencing this issue.

Still experiencing issue in v0.7.8, reload still corrects issue.

Same here, reloading fixes the issue.

Was this page helpful?
0 / 5 - 0 ratings