Skip to content
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

ZED_WORKTREE_ROOT should always point to a directory #22912

Open
1 task done
notpeter opened this issue Jan 9, 2025 · 0 comments
Open
1 task done

ZED_WORKTREE_ROOT should always point to a directory #22912

notpeter opened this issue Jan 9, 2025 · 0 comments
Labels
bite-size small issues bug [core label] good first issue Issue suitable for first-time contributors tasks

Comments

@notpeter
Copy link
Member

notpeter commented Jan 9, 2025

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

Steps to reproduce:

  1. Open your Zed tasks.json and add the following:
    {
      "label": "zed env",
      "command": "env | grep ZED"
    },
    
  2. Cmd-P, task: spawn, select zed env at the bottom of the list.
  3. Note:
    ZED_WORKTREE_ROOT=/Users/peter/.config/zed/tasks.json
    

Documentation suggests this variable will point to a folder, which I believe makes sense:

- `ZED_WORKTREE_ROOT`: absolute path to the root of the current worktree. (e.g. `/Users/my-user/path/to/project`)

Proposal: Behavior of ZED_WORKTREE_ROOT should match that default behavior of cwd which was improved in #22004 to not point at a file when spawned from a buffer that is outside of worktree (like the tasks.json example above).

This makes it possible to spawn other applications into the correct working directory, even when that must be passed an argument, not just implicitly inherited from cwd/$PWD.

For example:

  {
    "label": "lazygit",
    "command": "alacritty -o 'window.startup_mode=\"SimpleFullscreen\"' --working-directory ${ZED_WORKTREE_ROOT} --command lazygit",
    "hide": "always"
  },

This does not work: cd /tmp; alacritty (working directory defaults to ~)
This does work: alacritty --working-directory=/tmp

Originally reported by @VOID404 here:

Zed Version and System Specs

Zed: v0.170.0 (Zed Nightly af1a3cb)
OS: macOS 14.7.0
Memory: 64 GiB
Architecture: aarch64

If applicable, add screenshots or screencasts of the incorrect state / behavior

No response

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

N/A

@notpeter notpeter added bug [core label] triage Maintainer needs to classify the issue admin read Pending admin review labels Jan 9, 2025
@notpeter notpeter added good first issue Issue suitable for first-time contributors tasks bite-size small issues and removed triage Maintainer needs to classify the issue admin read Pending admin review labels Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bite-size small issues bug [core label] good first issue Issue suitable for first-time contributors tasks
Projects
None yet
Development

No branches or pull requests

1 participant