Skip to content

Don't show test lenses in libraries outside of the workspace #13664

Closed
@lnicola

Description

@lnicola
    So I just ran into this issue with types implemented in the standard library.

Here are my repro steps:

  1. Inside src/main.rs include the following:
use std::sync::Mutex;

fn main() {
    let m = Mutex::new(0);
}
  1. Place your cursor (|) in Mutex::ne|w and trigger "Go to definition" (A.K.A. F12).
  2. VS Code will display the code lens option to "Run Doctest" in the library's definition:

image

4. After clicking on that action, the output is:

image

Now, here are some thoughts. Note that I'm a Rust beginner (I encountered this while going though the Rust book hehe) so please take it with a grain of salt <3.

  1. I don't think that code lens inside code that I didn't write myself should be enabled at all, since those feel like "implementor/dev-only" tools, and I don't immediately see why the clients of the APIs would need them. So I wouldn't be upset if this feature is removed (it's not working anyway...).
  2. From the picture included in point 4 above, it seems like cargo test is running inside my current workspace, and not where the code lens is being displayed.

Originally posted by @MariaSolOs in #8248 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-idegeneral IDE featuresC-bugCategory: bugS-actionableSomeone could pick this issue up and work on it right now

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions