Skip to content

Instantly share code, notes, and snippets.

@vipmax
Created October 15, 2024 12:18
Show Gist options
  • Save vipmax/26052ea02264d358b1796c05616e8250 to your computer and use it in GitHub Desktop.
Save vipmax/26052ea02264d358b1796c05616e8250 to your computer and use it in GitHub Desktop.
zed tasks cwd example

Zed Tasks Configuration

This configuration allows Zed to run tasks with specific working directories for multiple projects.

Tasks Configuration

[
  {
    "label": "backend",
    "command": "cargo run --bin anycode_backend --release",
    "cwd": "$ZED_WORKTREE_ROOT/src/backend"
  },
  {
    "label": "frontend",
    "command": "pnpm run dev",
    "cwd": "$ZED_WORKTREE_ROOT/src/frontend"
  }
]

How to Use

  1. Copy the above JSON content into a .zed/tasks.json file in your project.
  2. Modify labels and paths to match your project structure.
  3. Press option-shift-t and select task.
@vipmax
Copy link
Author

vipmax commented Oct 15, 2024

If you have Rust subproject, put this config (fix paths) into file .zed/settings.json for rust-analyzer correct work

{
  "lsp": {
    "rust-analyzer": {
      "initialization_options": {
        "linkedProjects": [
          "src/backend/Cargo.toml"
        ]
      }
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment