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
51.05k stars 3.17k forks source link

test runner does not work when shell = `nu` #12685

Open universalmind303 opened 6 months ago

universalmind303 commented 6 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

Error: nu::parser::parse_mismatch

  × Parse mismatch during operation.
   ╭─[source:1:15]
 1 │ cargo test -p ${ZED_CUSTOM_RUST_PACKAGE} $ZED_SYMBOL -- --nocapture
   ·               ─────────────┬────────────
   ·                            ╰── expected valid variable name
   ╰────

⏵ Task `cargo test -p arrow2 test_primitive_array_eq -- --nocapture` finished with non-zero error code: 1
⏵ Command: 'nu -i -c `cargo test -p arrow2 test_primitive_array_eq -- --nocapture`'

related to https://github.com/zed-industries/zed/issues/12617.

Environment

Zed: v0.137.6 (Zed) OS: macOS 14.4.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 ~/Library/Logs/Zed/Zed.log file to this issue.

No response

osiewicz commented 6 months ago

That's fixed in latest Preview == it should be fixed on Stable (which you're using) in todays update.

universalmind303 commented 6 months ago

@osiewicz This is still an issue for nu on the latest release

Error: nu::parser::env_var_not_var

  × Use $env.ZED_CUSTOM_RUST_PACKAGE instead of $ZED_CUSTOM_RUST_PACKAGE.
   ╭─[source:1:15]
 1 │ cargo test -p $ZED_CUSTOM_RUST_PACKAGE $ZED_SYMBOL -- --nocapture
   ·               ────────────┬───────────
   ·                           ╰── use $env.ZED_CUSTOM_RUST_PACKAGE instead of $ZED_CUSTOM_RUST_PACKAGE
   ╰────

⏵ Task `cargo test -p arrow2 test_merge_reversed -- --nocapture` finished with non-zero error code: 1
⏵ Command: 'nu -i -c `cargo test -p arrow2 test_merge_reversed -- --nocapture`'
bemyak commented 2 months ago

I made this work by adding these tasks to my ~/.config/zed/tasks.json:

  {
    "label": "Run Rust tests",
    "command": "cargo test -p $env.ZED_CUSTOM_RUST_PACKAGE $env.ZED_SYMBOL -- --nocapture",
    "tags": ["rust-test"]
  },
  {
    "label": "Run Rust mod tests",
    "command": "cargo test -p $env.ZED_CUSTOM_RUST_PACKAGE $env.ZED_SYMBOL",
    "tags": ["rust-mod-test"]
  },
  {
    "label": "Run Rust main function",
    "command": "cargo run -p $env.ZED_CUSTOM_RUST_PACKAGE --bin $env.ZED_CUSTOM_RUST_BIN_NAME",
    "tags": ["rust-main"]
  }