-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix: project json runnable kind bin substitution #20396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
b3b3d93
to
4e74df9
Compare
I am not sure this is a fix, as the old behavior was not a bug, but documented: rust-analyzer/docs/book/src/non_cargo_based_projects.md Lines 203 to 207 in 3d2c40d
Though we have another comment that suggests this might be a bug: rust-analyzer/crates/project-model/src/project_json.rs Lines 316 to 319 in 3d2c40d
I am all for something like this change. I would propose to introduce a new "binOne" similar to "testOne" where this substitution applies. |
I added the I'm not necessarily opposed to applying the substitution on all runnables, but we should update the non_cargo_based_projects.md accordingly. |
On the comment about other runnable types, currently there is only TestOne and Run. The Check type is not used anywhere in the code see #20367 |
Honestly I would prefer if we go with a solution I have on my fork. See #20359 (comment) By adding the runnables to the crate itself instead of having a global runnables. The global runnables in my opinion were not well thought out since it's very likely in the case of external build systems that you have different targets for different runnables on the same crate. With the current design you can't really do this because we only have one label to substitute. |
I'd actually argue that's a compelling case for global runnables! :) By having a single command that rust-analyzer runs when you modify foo.rs, you can do nice things like merge duplicate build warnings (having a foo-proj and foo-proj-unittest is common in both buck and cargo). It also makes the JSON much smaller. |
I'm not sure I follow, I am referring to a single crate that has different labels depending on the runnable. Right now in the bazel implementation we always prioritize the test target to allow for the It seems buck2 does something similar here https://github.com/facebook/buck2/blob/5a565c288858a249e7043a27c2e271c92daf35bd/integrations/rust-project/src/buck.rs#L368-L373. There are only 2 runnables that work, It also makes the JSON much smaller.I don't believe this is an issue at all. This json is not being added to the VCS and if you use the discover command is simply piped and does not even write to disk. The argument that "larger json slower parse times" isnt really true. This file does not get nearly large enough for that to matter. In my case its just under 1MB (pretty-printed). I am writing it out because I want to debug the generated file when using discover command. These runnables are only added to the workspace crates not all dependencies.
|
fixes a bug related to substitution in project json bin not correctly replacing the `{label}` tag with the label of the current item.
4be202f
to
2f064dd
Compare
fixes a bug related to substitution in project json bin not correctly replacing the
{label}
tag with the label of the current item.