zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
48.52k stars 2.9k forks source link

Rust: don't show run button in build scripts #14720

Open kzhui125 opened 3 months ago

kzhui125 commented 3 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

image

Environment

Zed: v0.144.3 (Zed) OS: macOS 14.5.0 Memory: 32 GiB Architecture: aarch64

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

No response

If applicable, attach your Zed.log file to this issue.

Zed.log


versecafe commented 3 months ago

Every fn main() in rust is supposed to have the arrow with it, the file name shouldn't change that behaviour, what is your issue with it appearing in build.rs

kzhui125 commented 3 months ago

this is what in vscode, fn main in rust build scripts don't have run button @versecafe

image

A button that doesn't work shouldn't exist, that's a design problem.

kzhui125 commented 3 months ago

to clarify, not all build.rs files, only rust build scripts

https://doc.rust-lang.org/cargo/reference/build-scripts.html

osiewicz commented 3 months ago

I agree that we shouldn't show a run button in build scripts, but to just put it out there: it's a bit harder than just checking if a file is named build.rs, as the name of a build script can be arbitrary. We'd have to piggy-back out of output of cargo metadata for that functionality.

kzhui125 commented 3 months ago

also files not in crates:

image
versecafe commented 3 months ago

If the rust analyzer isn't doing anything neither is the LSP and the LSP is where the hooks for the test functions go so that last example isn't configured correctly, also why is there an expectation that it shouldn't be there, is there any issue to offering the feature?

kzhui125 commented 3 months ago

run button should only exists when it's runnable @versecafe

versecafe commented 3 months ago

Build scripts are runnable, you usually don't want to run them on their own but they should be runnable

kzhui125 commented 3 months ago

build scripts are for cargo build, run them on their own are not supported now https://github.com/rust-lang/cargo/issues/7178

We use run to print output (for example println!)

but output is not supported by build scripts now. https://github.com/rust-lang/cargo/issues/985

kzhui125 commented 3 months ago

Should run button be added for build scripts, click it doesn't work now(will be another bug).