zed icon indicating copy to clipboard operation
zed copied to clipboard

wrong crate name of auto generated rust test task

Open sunliang711 opened this issue 10 months ago • 1 comments

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

rust's crate name's format is underscore style, eg: folder named my-crate will be renamed to my_crate, while the auto generated rust test task's name use my-crate instead of my_crate.

so, the generated task should be fixed from "cargo test -p my-crate test_some_function --nocapture" to "cargo test -p my_crate test_some_function --nocapture"

image

Environment

Zed: v0.132.2 (Zed Preview) OS: macOS 14.4.0 Memory: 16 GiB Architecture: x86_64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

No response

sunliang711 avatar Apr 24 '24 02:04 sunliang711

Can you elaborate why would the hyphen crate name usage in Zed tasks be wrong?

Here's a sample cargo new project with hyphens and the test image it works for hyphened crate name both with Zed tasks image and the direct cargo invocations in the terminal image

There's been an issue with the way we retrieved those package names (incorrectly in case there's been an override in Cargo.toml): https://github.com/zed-industries/zed/issues/10925 but it's fixed in https://github.com/zed-industries/zed/pull/10929 and as you can see in the PR, we are merely getting the human-readable package name out of the cargo pkgid command, which also returns hyphens.

SomeoneToIgnore avatar Apr 24 '24 11:04 SomeoneToIgnore

Thinking of this more, cargo pkgid provides the hyphened names and cargo ... -p commands work with these, so I will close this, as https://github.com/zed-industries/zed/pull/10929 should have fixed all related issues.

Please comment, if there's something that is not working for you still after that fix.

SomeoneToIgnore avatar Apr 24 '24 23:04 SomeoneToIgnore

Great, it's working now, thank you for your hard working !

sunliang711 avatar Apr 25 '24 02:04 sunliang711