Stream: t-compiler/wg-rls-2.0

Topic: runnables fix


Coenen Benjamin (May 07 2020 at 14:18, on Zulip):

Hey @matklad sorry to disturb you but I wanted to have your opinion about the fix for https://github.com/rust-analyzer/rust-analyzer/issues/4356 . In fact I know we don't have to add the bin runnableKind if we are in a lib runnableTarget. It seems pretty clear but I have 2 options to implement the fix. First is to filter here https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/rust-analyzer/src/main_loop/handlers.rs#L387 because we have access to cargo_spec at this location. Other solution is to pass a new argument to this function https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/lib.rs#L443:L443 which would be the TargetKind to know if it's a lib we don't add binary target for main function. But it seems the second solution is better but I think it's a kind of antipattern for salsa to add this kind of argument instead of just keep the Id. And the first solution is a bit annoying because I have to filter at 2 different places: one for handler_runnables and one for handle_codelens. What do you think ?

Coenen Benjamin (May 07 2020 at 14:34, on Zulip):

And BTW for the second idea it will be an Option<TargetKind> and not just a TargetKind

matklad (May 07 2020 at 14:35, on Zulip):

I think it's better to filter out in handlers

Coenen Benjamin (May 07 2020 at 14:35, on Zulip):

Ok right, after trying to implement the second solution I think the same as you :p

matklad (May 07 2020 at 14:35, on Zulip):

In the ideal world, we should add crate_types field to crate graph, but we are not in an ideal world yet :D

Last update: May 29 2020 at 17:20UTC