Hi folks. My project has to be build with --features foo,bar,baz
because some dependencies have configs for these features. But I can't able to set this feature in rust-analyzer and because of that it is showing errors inside dependencies. I searched google but I didn't find any solution. Do you have any solution for this? Thanks.
There is the rust-analyzer.cargo.features
config value you can pass to RA. See the configuration section of the manual:
Unfortunately not working. Also check.features
not working too. The exact error message is here:
2025-01-26T14:53:05.0707892+03:00 ERROR Flycheck failed to run the following command: CommandHandle
{ program: "C:\\Users\\emir\\.cargo\\bin\\cargo.exe",
arguments: ["check", "--workspace", "--message-format=json-diagnostic-rendered-ansi",
"--manifest-path", "C:\\project\\Cargo.toml", "--keep-going",
"--all-targets", "--features", "foo bar"],
current_dir: Some("C:\\project") },
error=Cargo watcher failed, the command produced no valid metadata
(exit code: ExitStatus(ExitStatus(101))):
I used these configs:
"rust-analyzer.check.features": [
"foo,bar
],
"rust-analyzer.cargo.features": [
"foo,bar"
],
And this:
"rust-analyzer.check.features": [
"foo", "bar"
],
"rust-analyzer.cargo.features": [
"foo", "bar"
],
Setting rust-analyzer.check.features
is superfluous in your case as it defaults to rust-analyzer.cargo.features
. Your second config looks right though. What happens when you try to enable all features?
"rust-analyzer.cargo.features": "all"
Same errors showing in PROBLEMS tab.
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.