You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then I created bar_backend/mod.rs. However, rust-analyzer isn't analyzing the file (not providing IDE services) because the module declaration is under a cfg attribute. The declaration appears greyed out with a message saying the code ignored feature is disabled
I understand that since the feature is disabled, the code is ignored, which prevents the module from being analyzed. I tried to enable the feature by:
Creating a rust-analyzer.json file with:
{
"rust-analyzer.check.features": "all",
}
This didn't work, and I couldn't verify if the rust-analyzer.json file was being read by rust-analyzer.
Then I tried adding this to my Cargo.toml:
[profile.dev]
features = ["bar_feature"]
This un-greyed the module declaration (the #[cfg] part), but bar_backend/mod.rs is still not being analyzed.
Any way to get the IDE services in that file
I am working in neovim if you need other details ask
The text was updated successfully, but these errors were encountered:
The way to pass configuration flags to rust-analyzer depends on your editor, and is usually not a file called rust-analyzer.json. For example, in VSCode, you need to create .vscode/settings.json. Also, the setting you want is "rust-analyzer.cargo.features": "all", not rust-analyzer.check.features.
@ChayimFriedman2 yeah thanks that actually fixed it I went to my configuration and added the setting there I got the idea of rust-analyzer.json from chatGPT but that was clearly a mistake thanks
I'm creating a library crate with optional features and dependencies. In my
Cargo.toml
, I have:In
lib.rs
, I declared a module like this:Then I created
bar_backend/mod.rs
. However, rust-analyzer isn't analyzing the file (not providing IDE services) because the module declaration is under acfg
attribute. The declaration appears greyed out with a message saying the code ignored feature is disabledI understand that since the feature is disabled, the code is ignored, which prevents the module from being analyzed. I tried to enable the feature by:
rust-analyzer.json
file with:This didn't work, and I couldn't verify if the rust-analyzer.json file was being read by rust-analyzer.
Cargo.toml
:This un-greyed the module declaration (the
#[cfg]
part), butbar_backend/mod.rs
is still not being analyzed.Any way to get the IDE services in that file
I am working in neovim if you need other details ask
The text was updated successfully, but these errors were encountered: