-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Make ZED_WORKTREE_ROOT always point to a directory or is not set #23150
Conversation
67adf48
to
ab14e88
Compare
@osiewicz , I've updated the PR with the behavior that you suggested. Will look into writing a test. |
Now that I think about it, maybe when |
ab14e88
to
d2dfd28
Compare
I think this is the right approach, I've double-checked that on the detached files, the behavior is identical to the [crates/terminal_view/src/terminal_panel.rs:451:9] &spawn_in_terminal = SpawnInTerminal {
id: TaskId(
"oneshot_207ea101dedafe545a2e9eb5b80020e6b71a5b0d29fec56e4dd4488822939b51_1072e6503c4689620973fb491aee92e007207cde652ea674817aef523004b243",
),
full_label: "echo $(pwd) && sleep 2",
label: "echo $(pwd) && sleep 2",
command: "echo $(pwd) && sleep 2",
args: [],
command_label: "echo $(pwd) && sleep 2",
cwd: None,
env: {
"ZED_FILE": "/home/aborg/.config/zed/settings.json",
"ZED_SYMBOL": "ui_font_size",
"ZED_FILENAME": "settings.json",
"ZED_ROW": "20",
"ZED_COLUMN": "21",
"ZED_DIRNAME": "/home/aborg/.config/zed",
"ZED_STEM": "settings",
},
use_new_terminal: false,
allow_concurrent_runs: false,
reveal: Always,
reveal_target: Dock,
hide: Never,
shell: System,
show_summary: false,
show_command: false,
} I think any future improvements should change @notpeter , does this make sense? If so, what are the next steps for landing this change? |
I think you're right in that |
d2dfd28
to
f703e60
Compare
Rebased the PR on the latest @notpeter , can we land this PR now? Or is there anything else you would like to add? |
Merged. Additional context to #22912 to reflect the updated state (unset var). Thanks @aborg-dev for the bump. |
See: #22912
When the out-of-tree file like
tasks.json
is selected, theZED_WORKTREE_ROOT
is now unset.This fixes the immediate problem with
ZED_WORKTREE_ROOT
pointing to the file, but the desired long-term behavior is still under discussion.At the moment,
BasicContextProvider::build_context
does not have any information about the active project, so there is no way to get the root directory of the active project without plumbing in more context.Release Notes:
ZED_WORKTREE_ROOT
incorrectly pointing to a file. Now points to a directory when current file is a project or unset when in out-of-project files (settings.json, tasks.json, etc).