Anyone what the current status of rust-analyzer regarding integration tests? I seem to have complaints about code not being used and also code not being formatted when writing more than one integration test files
Would love to contribute and fix this issue if I know the current state
Making a small example that reproduces the issue would be a good first step. It works for me, but I had to restart RA after adding the integration test.
You generally need to do this when changing
Cargo.lock or when adding new build targets.
Huh, I didn't try that, but I seem to have tried restarting vscode
Even adding new examples, I guess?
I think so. I mean you don't have to restart it, but some features might not work correctly.
Thanks for the info. I will look into it a bit tonight
So, I restarted it, but the issues didn't go away. Shown is the code for the integration test. content_type_tide.rs. As you can see, I am using the type
ContentType but there's a warning. This is not happening for all the integration tests, though. files
If you remove the feature attribute does it work?
Not sure about this, because the feature is tied into so many things. But the
content_type_gotham.rs you see has similar stuff. Feature attribute followed by
tokio::test followed by
async and that file is good
Also, I had all features enabled for cargo check option set to true
We should verify that the features work. I tried it last week while working on
lsp-types and could not get the "proposed" feature to work.
So, you are saying that only some features might work?
@Jeremy Kolb @Laurențiu Nicola So, based on the behaviour, I figured out that only default features are being used when checking integration tests. Even though I have
all features setting enabled. Does that narrow the bug?
What I meant is that if you add new dependencies or targets, some RA features might not work properly until you restart the server.
There might be issues in the cargo check integration, I'm not sure how setting the features works. It doesn't match my expectations -- it looks like it should trigger extra recompiles, but I didn't notice it. Anyway, if you have a small project that reproduces your problem, you could file an issue on GitHub.
Like, I wouldn't be surprised if that
allFeatures option didn't work at all.
Maybe I'm missing something, but I don't see where that setting is wired up.
Ah, it's using
#[serde(rename_all = "camelCase")]
@pksunkara It works for me if I set:
"rust-analyzer.cargo-watch.arguments": [ "--features", "broken" ]
"rust-analyzer.cargo-watch.arguments": [ "--all-features", ],
I filed https://github.com/rust-analyzer/rust-analyzer/issues/3386, which is somewhat related
Maybe, this option is not about activating all features for cargo-watch
No, I think that one is used when loading the workspace. RA runs
cargo metadata to figure out which dependencies the project has, download them, find out the project structure and so on.
If you want to pass
cargo watch, you should try the other preference
But beware of it compiling the code twice, as I mentioned above. If you run
cargo run from the terminal and
cargo check --all-features from RA,
cargo will rebuild a lot of your project.