zed icon indicating copy to clipboard operation
zed copied to clipboard

Tasks environment variables are empty when file `Language` is `Unknown` or `Plain Text`

Open Burmuley opened this issue 1 year ago • 1 comments

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

When I have a file opened in Zed and its Language is set to Unknown or Plain Text then when I run any task against this file all the variables are empty (like ZED_FILE or ZED_WORKTREE_ROOT). If I select any language, even if the file does not belong to it, the running task has all the variables properly set.

In the logs I see lines like this:

[ERROR] crates/project/src/project.rs:6824: no package metadata for file file:///PATH/TO/PLAIN_TEXT/FILE.txt

I believe users should be able to run any tasks against any files, even if Language is not identified or supported by Zed editor.

Environment

Zed: v0.131.7 (Zed) OS: macOS 14.4.1 Memory: 32 GiB Architecture: aarch64

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

A simple test task to reproduce the behavior:

{
    "label": "Test task",
    "command": "env | grep ZED",
    "use_new_terminal": false,
    "allow_concurrent_runs": false,
    "reveal": "always"
  }

Output when file Language is Unknown or Plain Text:

ZED_TERM=true

Output for the same file when Language is other than Unknown or Plain Text:

ZED_COLUMN=2
ZED_FILE=/PATH/TO/PLAIN_TEXT/FILE.txt
ZED_ROW=22
ZED_TERM=true
ZED_WORKTREE_ROOT=/PATH/TO/PLAIN_TEXT/

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

No response

Burmuley avatar Apr 23 '24 03:04 Burmuley

Thank you for reporting, this was fixed in https://github.com/zed-industries/zed/pull/10764 and will be available in Zed 0.133 tomorrow.

SomeoneToIgnore avatar Apr 23 '24 05:04 SomeoneToIgnore

I'm closing this issue as it was resolved in #10764. Keep an eye out for the Zed 0.133 release 👀

Moshyfawn avatar Apr 23 '24 16:04 Moshyfawn