Stream: t-compiler/wg-rls-2.0

Topic: integration tests


pksunkara (Feb 26 2020 at 14:09, on Zulip):

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

pksunkara (Feb 26 2020 at 14:09, on Zulip):

Would love to contribute and fix this issue if I know the current state

Laurențiu Nicola (Feb 26 2020 at 14:13, on Zulip):

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.

Laurențiu Nicola (Feb 26 2020 at 14:14, on Zulip):

You generally need to do this when changing Cargo.toml, Cargo.lock or when adding new build targets.

pksunkara (Feb 26 2020 at 14:14, on Zulip):

Huh, I didn't try that, but I seem to have tried restarting vscode

pksunkara (Feb 26 2020 at 14:14, on Zulip):

Even adding new examples, I guess?

Laurențiu Nicola (Feb 26 2020 at 14:14, on Zulip):

I think so.

pksunkara (Feb 26 2020 at 14:15, on Zulip):

Thanks for the info. I will look into it a bit tonight

pksunkara (Feb 26 2020 at 17:55, on Zulip):

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

Jeremy Kolb (Feb 26 2020 at 18:01, on Zulip):

If you remove the feature attribute does it work?

pksunkara (Feb 26 2020 at 19:31, on Zulip):

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

pksunkara (Feb 26 2020 at 23:36, on Zulip):

Also, I had all features enabled for cargo check option set to true

Jeremy Kolb (Feb 27 2020 at 00:36, on Zulip):

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.

pksunkara (Feb 27 2020 at 13:16, on Zulip):

So, you are saying that only some features might work?

pksunkara (Mar 01 2020 at 13:35, on Zulip):

@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?

Laurențiu Nicola (Mar 01 2020 at 13:41, on Zulip):

What I meant is that if you add new dependencies or targets, some RA features might not work properly until you restart the server.

Laurențiu Nicola (Mar 01 2020 at 13:48, on Zulip):

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.

Laurențiu Nicola (Mar 01 2020 at 14:13, on Zulip):

Like, I wouldn't be surprised if that allFeatures option didn't work at all.

Laurențiu Nicola (Mar 01 2020 at 14:16, on Zulip):

Maybe I'm missing something, but I don't see where that setting is wired up.

Laurențiu Nicola (Mar 01 2020 at 14:18, on Zulip):

Ah, it's using #[serde(rename_all = "camelCase")]

Laurențiu Nicola (Mar 01 2020 at 14:30, on Zulip):

@pksunkara It works for me if I set:

    "rust-analyzer.cargo-watch.arguments": [
        "--features",
        "broken"
    ]

or

"rust-analyzer.cargo-watch.arguments": [
        "--all-features",
    ],
Laurențiu Nicola (Mar 01 2020 at 14:34, on Zulip):

I filed https://github.com/rust-analyzer/rust-analyzer/issues/3386, which is somewhat related

pksunkara (Mar 01 2020 at 14:35, on Zulip):

Settings__integrationbot.png

pksunkara (Mar 01 2020 at 14:35, on Zulip):

Maybe, this option is not about activating all features for cargo-watch

Laurențiu Nicola (Mar 01 2020 at 14:43, on Zulip):

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.

Laurențiu Nicola (Mar 01 2020 at 14:44, on Zulip):

If you want to pass --all-features to cargo watch, you should try the other preference

Laurențiu Nicola (Mar 01 2020 at 14:44, on Zulip):

But beware of it compiling the code twice, as I mentioned above

Last update: May 29 2020 at 16:45UTC