rust-lang / vscode-rust

Rust extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=rust-lang.rust
Other
1.39k stars 167 forks source link

No Autocomplete in Integration Tests for Items from the Library Target #619

Open Zehua-Chen opened 5 years ago

Zehua-Chen commented 5 years ago

I am running:

In my integration tests, autocomplete does not seem to be able to provide completions for items from my library target. However, autocomplete works fine for items within the integration test.

Cargo.toml

[package]
name = "xxx"
version = "0.1.0"
authors = ["xxx"]
edition = "2018"

[lib]
name="mylib"
path="src/lib.rs"

src/lib.rs

pub struct Node {
    value: i32 
}

tests/test.rs

use mylib;

fn other() {
}
#[test]
fn test() {
    let node = mylib::Node{ value: 1 }; // No autocomplete for Node
    other(); // Autocomplete works fine for other
}

Although this compiles just fine.

Put extern crate mylib at the top of the test.rs fixes the issue and still compiles just fine, but the tutorial doesn't use them. It just uses use mylib;

Edit:

I rustup to 1.36, still having the same problem.

focorner commented 5 years ago

I'm experiencing the same thing.

My setup:

ta32 commented 5 years ago

ditto, was going to raise and issue It does work with CLion and the intelli-j rust plugin.

Is this an RLS issue or a vscode issue?

CLion + rust has a whole bunch of other issues...

eoarch commented 4 years ago

I have this as well. Experienced on Ubuntu 19.10/VSCode and Windows with same configuration.

Zehua-Chen commented 4 years ago

rust-analyzer fixes this issue!