-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
I am raising this issue following the conversation on wg-rls-2.0 (topic "Support for #[cfg(test)]").
The test cfg option is currently added unconditionally when loading the source of a crate. A similar approach is usually followed for project using the rust-project.json model.
It is a standard pattern for mocking library to use the attribute: #[cfg(not(test))]. Because of this, the name resolution (i.e. go to definition) will jump to the mocked value instead of the original one.
For the rust-project.json-based model, it is possible to declare the crate with and without the configuration enabled. We should support the configuration selection, as provided by the client, to use one or the other crate. We may use the initializationOptions during the initialize request to provide rust-analyzer with the information on which configuration should be enabled.
@woody77 @Nashenas88 @flodiebold Did I miss anything from the conversation? Thanks.